Is there any way to simplify this? Ideas are appreciated.
An Azure Storage blob trigger only lets you monitor one storage container for new and updated blobs. If you want to monitor multi containers in a Azure Storage Account, you need to create multi functions.
I suggest you write the blob changed processing logic in one method and invoke this method when other functions are called.
public static void ProcessBlob(string containerName, string blobName, CloudBlockBlob blob)
{
//Write your logic here
}
public static void ProcessBlobContainer1([BlobTrigger("container1/{blobName}")] CloudBlockBlob blob, string blobName)
{
ProcessBlob("container1", blobName, blob);
}
public static void ProcessBlobContainer2([BlobTrigger("container2/{blobName}")] CloudBlockBlob blob, string blobName)
{
ProcessBlob("container2", blobName, blob);
}
There is open issue on GitHub which related to your question, hoping that it will be solved soon.
Add ability to create blob triggers on a container names that match a pattern