Search code examples
azureazure-functionsazure-blob-storageazure-triggers

Re-play/Repeat/Re-Fire Azure BlobStorage Function Triggers for existing files


I've just uploaded several 10s of GBs of files to Azure CloudStorage. Each file should get picked up and processed by a FunctionApp, in response to a BlobTrigger:

[FunctionName(nameof(ImportDataFile))]
public async Task ImportDataFile(
    // Raw JSON Text file containing data updates in expected schema
    [BlobTrigger("%AzureStorage:DataFileBlobContainer%/{fileName}", Connection = "AzureStorage:ConnectionString")]
    Stream blobStream,
    string fileName)
{
    //...
}

This works in general, but foolishly, I did not do a final test of that Function prior to uploading all the files to our UAT system ... and there was a problem with the uploads :(

The upload took a few days (running over my Domestic internet uplink due to CoViD-19) so I really don't want to have to re-do that.

Is there some way to "replay" the BlobUpload Triggers? so that the function triggers again as if I'd just re-uploaded the files ... without having to transfer any data again!


Solution

  • I found a hacky-AF work around, that re-processes the existing file:

    If you add Metadata to a blob, that appears to re-trigger the BlobStorage Function Trigger.

    Accessed in Azure Storage Explorer, but Right-clicking on a Blob > Properties > Add Metadata.

    I was settings Key: "ForceRefresh", Value "test".