Azure Functions: configure blob trigger only for n

2019-02-06 08:41发布

问题:

I have about 800k blobs in my azure storage. When I create azure function with a blobTrigger it starts to process all blobs that I have in the storage. How can I configure my function to be triggered only for new and updated blobs?

回答1:

There is no way to do this currently. Internally we track which blobs we have processed by storing receipts in our control container azure-webjobs-hosts. Any blob not having a receipt, or an old receipt (based on blob ETag) will be processed (or reprocessed). That's why your existing blobs are being processed - they don't have receipts. BlobTrigger is currently designed to ensure that ALL blobs in a container matching the path pattern are eventually processed, and reprocessed any time they are updated.

If you feel passionately about this, you can log a feature request in our repo here with details on your scenario.



回答2:

Did anyone find some kind of workaround for this? I'm currently trying to use a BlobTrigger in Azure Functions to process SQL Audit logs.

I only need the newer logs going forward, but we have a pretty high retention period, so going through all those blobs with a NOOP (on several environments and the receipts are per running host too) seems a very slow/bad way to go about it.