While doing some testing recently with Logic Apps I had some workflows fail with a status code of 429 when calling Dynamics 365 actions. A 429 status code indicates that the number of API calls to Dynamics 365 in one minute has been exceeded. This post explains how you can configure the concurrency setting of a Logic Apps workflow to avoid this problem.
Logic Apps is a superb cloud integration platform and one scenario where I use it is to create Http endpoints that accept a Json payload kicking off a workflow that updates Dynamics 365 and other back-end platforms in the cloud or on premise. This is a good way of creating API’s that can be used in a S2S, server to server, environment abstracting the workings of the API from the calling process. This was the scenario I was testing and the reason the workflows started to fail is that we had triggered a huge volume of calls to our endpoint in short period of time. Logics Apps worked brilliantly and scaled up to handle the thousands of requests whilst off the workflows to run asynchronously. However as all these workflows started to call Dynamics 365 some beganto fail as they breeched the number of API calls allowed in a minute.
The solution was easy I simply need to go to the settings of the workflow settings and configure the Concurrency Control setting restrict the number of instances of the workflow that can run currently. Just be aware that once you turn this setting on you cannot turn it off.
Having set the concurrency Degree of Parallelism to 5 we only ever get five workflows running concurrently and the others will wait to start. This avoids us exceeding the number of Dynamics 365 Web API calls limits we make in a minute.
It is not just Dynamics 365 that has rate limit restrictions and you can get the 428 errors when calling actions for other connectors. If you are interested in learning more about the Dynamics 365 Web API Limits my fellow MVP Daniel Cai has written a good post here