Trigger Azure Function repeatedly with Do Until in Power Automate

The Case

In a project I was working on I had the requirement that we needed to run a validation of data that was added to a list in SharePoint, and perform some advanced logic to update several other lists based on the input. The requirement was to run the check every five minutes for a given period of time. The

Do Until

To solve the problem with could have used Power Automate for the logic, but we found it easier and more robust to trigger an Azure Function to perform the logic. To be able to trigger the function repeatedly, we used a Do Until step in the Flow using a counter and a Delay action in the following manner (trigger functionality and initialization of variables have been omitted fore readability):

For this example, I have hard coded the number of times the loop should run, but in real life this would be a parameter coming in to the flow. In more detail, for the Do Until step we set the limits (as an example) of the loop to a max count of 24 and a timeout of PT120S (120 seconds according to ISO 8601):

Each time the Do Until loop runs, a message is added to an Azure Queue using the “Put a message on a queue” action (requires premium license). After the message has been added to the queue, we add a Delay for 5 minutes (in the real life solution, all the hard coded values here are fetched from a settings list in SharePoint in the start of the flow):

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s