1

I'm trying to set up a blob trigger function that only triggers on a blob update. Looking at the Microsoft docs I've only been able to figure out the example that triggers on a create and update. I haven't found anywhere that gives an example of how to specify when it fires off the trigger. Is there a way to specify it to only trigger when a blob is updated and not created? Like an attribute or something?

[Function("BlobTrigger")]
public void Run([BlobTrigger("blob/{name}", Connection = "")] string myBlob, string name)
{
    _logger.LogInformation($"C# Blob trigger function Processed blob\n Name: {name} \n Data: {myBlob}");
}
dustinos3
  • 934
  • 3
  • 17
  • 27
  • 1
    I dont think it is supported. you could always get the creation and modification date and compare that ? Not sure if that would work. – Thomas Jul 12 '22 at 01:41
  • 1
    Not related but there are some limitation regarding the default blob trigger: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-trigger?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp#polling. another approch is to use eventgrid trigger: https://learn.microsoft.com/en-us/azure/azure-functions/functions-event-grid-blob-trigger?tabs=csharp – Thomas Jul 12 '22 at 01:43

1 Answers1

0

One of the workarounds is to use logic apps's When a blob is added or modified (properties only) (V2) trigger. Where the workflow gets triggered whenever the blob gets modified. In the workflow, you can add the Azure function's HTTP trigger and make the Azure function trigger everytime a blob gets created or updated. Below is the flow of logic app.

enter image description here

RESULTS:

In my logic App

enter image description here

In my Function App

enter image description here

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18
  • In the logic app is there an option to only trigger on a blob update? In your screenshot it says when a blob is added or modified. I don't want this trigger running on blob creation – dustinos3 Jul 13 '22 at 16:00
  • @dustinos3 As of now there is no trigger which only triggers only when blob is modified but triggers when created / modified – SwethaKandikonda Jul 13 '22 at 16:08