I have developed a Blob Trigger Azure function. This will trigger when a file uploads to blob folder. This function will get this uploaded file, Encrypts it and copy the encrypted file into another blob folder.
I can see my function is getting triggered when a new file is added to blob. But I can also see that my function is getting triggered when I am removing the file from blob.
How can I restrict this. My Azure Function has to run only when new BLOB is UPLOADED. It should not run when I delete any file from the blob.
Please suggest me an approach. Thank you.
CodePudding user response:
I see you added the Event Grid tag so I would assume you are using Event Grid here and if not, then you can consider it as an option since it will allow you to filter in/out events based on event type or payload.
When you create the event grid topic subscription there is a filter section called "event type" on this you can select which events are to be filtered out from Event Grid and you can find the available event types here docs In your case make sure to only select BlobCreated events, just so those are the only ones sent to the destination Function App.