简体   繁体   中英

Only fire off Blob trigger function on update

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}");
}

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.

在此处输入图像描述

RESULTS:

In my logic App

在此处输入图像描述

In my Function App

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM