“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
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.
Summary
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.
About the Author
Hello and welcome! My name is Tom Riha (Tomáš Říha in full using Czech alphabet) and I’m a business process automation consultant and Microsoft MVP living in the Czech Republic.
I’ve been working with Microsoft technologies for more than 10 years in various roles – analyst, developer, architect, team leader, project manager…, but now I’m simply a freelance consultant specialising on Power Platform (PowerApps, Power Automate, Power Virtual Agents), SharePoint, Teams, and the other M365 tools.
References
Riha, T., (2023), ‘Building a flow to restore deleted Power Automate flows’, available at: https://tomriha.com/building-a-flow-to-restore-deleted-power-automate-flows/ [accessed 26th March 2024].