For several of my customers I need to monitor if flows fail or are being set to the disabled state. For example if a solution import of flows fails. Till now this is not default functionality in Microsoft Automate, so has to be custom developed. I use a flow for this, the periodacaly checks if one of the flows is being disabled, or if any failed runs arises.
I use the “List flows as admin” action to find all custom flows (including flows within solutions). This action lists all flows, together with the state of each flow. Unfortunately, there is no listing of runs within this connector. So we have to make our own connector to list the runs within a flow. All steps for creating this flow are:
- Create App registration in Azure to access the Automate Management endpoint
- Create Custom Connector to list runs, using the app registration for authorization
- Create the Check Status en failed runs flow
Some resources where steps are described in more detail:
- https://d365dotblog.com/2021/08/25/how-to-create-custom-connector-to-get-the-flow-run-history/
- https://docs.microsoft.com/en-us/connectors/custom-connectors/define-blank
Create App Registration
When creating an app registration, the following steps are important:
- Redirect URL: “https://global.consent.azure-apim.net/redirect”
- Create permissions for access to read flows:
Create custom connector
In the custom connector there will be the call to the endpoint checking the flow runs. This call is:
https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/{EnvironmentID}/flows/{FlowID}/runs?api-version=2016-11-01
Create flow
If you see any improvements, pleasae let me know: elowy@grootcrm.nl.
Wish you all the luck with this flow!