Search code examples
azure-functionsazure-blob-storageazure-webjobs-triggeredazure-blob-trigger

Azure Functions BlobTrigger not firing for deleted blobs from container in azure storage account


Azure Function is not being called for deleted blobs. I am referring sample code - https://learn.microsoft.com/bs-latn-ba/azure/azure-functions/functions-bindings-storage-blob-trigger?tabs=csharp

Below is the sample code -

[FunctionName("BlobTriggerCSharp")] public static void Run([BlobTrigger("samples-workitems/{name}")] Stream myBlob, string name, ILogger log) { log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes"); }

Expected behavior

Azure Functions Blob storage trigger (azure function) should be fired (called) when the blob is deleted from the container

Actual behavior

Azure Functions Blob storage trigger (azure function) is not being fired (called) when the blob is deleted from the container

I am using the latest Package - Microsoft.Azure.WebJobs.Extensions.Storage (version - 4.0.2)

Can someone please help me?

Thanks, Sanjay


Solution

  • As you see here, that this way you will be able to create a function app that runs when a blob is added to or updated in Blob storage.

    You might want to use Event Grid Triggers for this scenario. These events are triggered when a client creates, replaces, or deletes a blob by calling Blob REST APIs.