0
votes

Azure function is processing multiple files in blob storage at same time. This is causing duplicate data creation in dynamics CRM because azure function is processing multiple file in parallel execution. Can someone help me , how i can restrict azure function to process one file at a time?

1
This is quite a difficult question to answer. You have not described anything you are doing, or have tried yourself, in order to solve your problem. What is the function doing? What does the files look like? What, in CRM, is being duplicated?Peter Lillevold
question from CRM Side, Why are you not using Addons provided my Mircrosoft labs itself which will add (move) all your notes/attachment to azure blob storage. You need not code for this as functionality is already built. appsource.microsoft.com/en/product/dynamics-365/…AnkUser

1 Answers

2
votes

According to the section Trigger - concurrency and memory usage of the offical document Azure Blob storage bindings for Azure Functions, as the figure below.

The blob trigger uses a queue internally, so the maximum number of concurrent function invocations is controlled by the queues configuration in host.json. The default settings limit concurrency to 24 invocations. This limit applies separately to each function that uses a blob trigger.

enter image description here

So you can follow the content of the host.json template file as below to set the queues.batchSize value to 1 to restrict Azure Function with Blob Trigger to process one file per time.

enter image description here

As references, there are two similar SO threads which you can also refer to.

  1. Azure Functions - Limiting parallel execution
  2. Throttling Azure Storage Queue processing in Azure Function App