Recently, an update has been applied to Power Automate to automatically turn-off (disabled) infrequent flows.
With this update, flows that have not run for 90 days (or 60 days) will be automatically turned off after 7 days' notice.
However, for infrequent flows, e.g., flows that only run once a year, the user must manually re-enable the flow or edit and save it, even though there is no need to update anything.
In this post, I'll show you how to immediately and automatically re-enable a flow that has been automatically disabled.
Getting flow info. from email
The email you receive always comes with the subject line 'Alert! Your flow has been turned off since it was not running'.
Also, if you look at the body of the email (HTML), you'll see a link to the flow in the body of the email.
Since the link to the flow is starting with following format, it's easily extract information of the flow (environment name and flow name) from URL:
https://flow.microsoft.com/manage/environments/[environment_name]/flows/[flow_name]/details...
Make flow to automatically re-enable flow
The re-enablement flow itself is very simple, it consists of only three steps, including the trigger.
- [Trigger] When a new email arrives (V3) in Outlook connector
- [Action] Compose in data operation
- [Action] Turn On Flow in Power Automate Management connector
In order to make the flow responsive only to emails that turn-off the flow, the trigger sets up a filter by email subject - "Alert! Your flow has been turned off since it was not running".
The Compose action performs two string splits to retrieve the URL of the flow from the body of the email with following expression. The output of this action is a part of entire flow URL [environment_name]/flows/[flow_name]
, which can identify the flow in tenant.
split(split(triggerBody()?['body'],'https://flow.microsoft.com/manage/environments/')?[1],'/details')?[0]
Finally, turn on the flow using Power Automate Management action. The action has two inputs, environment name and flow name, which can be obtained by split result string in previous Compose:
Environment
split(outputs('Compose_-_extract_url'),'/flows/')?[0]
Flow
split(outputs('Compose_-_extract_url'),'/flows/')?[0]
Please leave comment if you have any questions for this :)