“Even though the Power Automate flow is not used very often, it must stay on, can I somehow turn it back on after I receive the turned off email?”
Once you work with Power Automate for more than 90 days, you might start getting some interesting emails. More specifically, an email telling you that your flow was turned off. It didn’t run for 90 days, meaning it’s not used, and as such it was turned off automatically. Yet often it’s not that simple. Some flows just don’t run very frequently but shouldn’t be turned off nevertheless!
How do you keep them on? Even during your holiday when you won’t read the “turn off” email to react?
Build a flow to turn them back on
Since you probably don’t want to turn on all suspended flows in your environment, you shouldn’t list all environments with all flows, and turn them on. You should turn on only the one that was disabled automatically and not by the users. The one mentioned in the “turn off” email.
Start from an automated flow with the trigger ‘When a new email arrives’. As you don’t want to process all emails, add a subject filter for these emails. It might differ based on your language settings, but in English it’s as below.
Alert! Your flow has been turned off since it was not running
As you can see on the email screenshot above, the email includes a link to the disabled flow that might look like:
If you look properly, you’ll see some familiar information in the url – the environment id and the flow id.
These are the two values you’ll need to turn the flow back on. Extract them from the email body using an expression, e.g. split(…).
Environment id: split(split(triggerOutputs()?['body/body'],'environments%2F'),'%2Fflows%2F')
Flow id: split(split(triggerOutputs()?['body/body'],'%2Fflows%2F'),'%2Fdetails%')
Put these expressions in the ‘Enable Flow as Admin’ action to enable the flow again.
You might also consider adding an email at the end to let you know that the flow was successful.
As you can see, it’s quite a simple flow to turn on the disabled Power Automate flows based on the “turn off” email. You don’t need to list all environments and all the flows, and turn on even the flows that should stay disabled. The email gives you all the information you need, the environment id and the flow id, which you can extract to enable the flow again.