“Oops, it’s gone. My Power Automate flow is no longer to be found, how can I see whether it was deleted and how to restore it?”
This article is motivated by one very stressful evening during the preparation of the approval template. While I was editing the flow to replace one environment variable, something happened. Something bad. Out of the blue, the flow was gone. Instead of a flow I spent tens of hours creating I saw an error message – the flow doesn’t exist. And I went into a panic mode. So this article is for me too, to not panic again in the future just because a flow goes missing.
Note: you must be an environment administrator to use this flow.
What happens to deleted flow?
When you delete a flow, it isn’t lost forever. It’s only “soft-deleted” and it stays in that state for 21 days. If you notice that a flow is missing in these 21 days, you can restore them. If it takes you longer you’re out of luck – the flow is gone forever.
I personally find it interesting that you can’t see and restore these flows through the Power Platform environment admin page, yet you can do it with another flow.
How to find and restore deleted flow
You can manage other flows from a flow through the ‘Power Automate Management’ group of actions. Additionally to the already used ‘Turn On Flow’, it has also an action ‘Restore Deleted Flow as Admin’.
Select the environment, select the flow, and restore it.
The small problem is that the flow doesn’t exist anymore – how can you select it from a dropdown…? You can’t.
You’ll have to add one more action, ‘List flows as Admin’. Add it to the flow and configure it to ‘Include Soft-Deleted Flows’.
Filter the results with ‘Filter array’ to find the flow by its name, and use the ‘Flow name’ (which is actually the flow id) to recover it.
The flow will be restored, although turned off. Turn it on and you’re done.
Get daily overview of deleted flows
When reading about the 21 days after which flows are completely gone, you might think that it’d be nice to keep track of these flows. To avoid any surprises that a flow that’s running once a month won’t run anymore as it was deleted.
It’s doable with a scheduled flow using similar set of actions. Start with a daily trigger and list all flows as admin.
Since this time you’re interested only in deleted flows, and ideally those deleted the previous day, use a combined filter.
@and(equals(item()?['properties/state'], 'Deleted'),greater(item()?['properties/lastModifiedTime'], addDays(utcNow(), -1, 'yyyy-MM-dd')))
Create an HTML table with the flows and send yourself an email.
This way you can keep track of all the deleted flows. You don’t have to guess their names as you’ll get them in an email. If needed, restore them with the first flow in this article.
It’s a bit sad that you can’t restore deleted flow directly from the admin portal, but luckily you can build a Power Automate flow to do it for you. This article explained two such flows. One flow to do the actual restoration, but you’ll need at least the flow name to do that. That’s why it’s helpful to build also the second flow, to keep track of every deleted flow, without the need to know its name to the last letter.