Restore deleted flows
If you or someone else accidentally deletes a non-solution or solution flow, you can restore it within 21 days of deletion.
There are the two ways you can restore deleted flows.
- Use the Power Automate Management connector to restore the deleted flows.
- Use PowerShell to restore the deleted flows.
Note
- The steps in this article apply to both non-solution and solution flows.
- Flows that were deleted more than 21 days ago can't be recovered. Both restore methods (PowerShell script and Power Automate Management connector), as well as Microsoft Support can't help to restore them.
- After you restore a flow, it defaults to the disabled state. You must manually enable the flow, per your requirements.
- Learn more about restoring a deleted desktop flow created by Power Automate for desktop at Restore a deleted desktop flow.
Restore deleted flows with the Power Automate Management connector
You can restore a deleted non-solution or solution flow within 21 days of deletion using Power Automate. A non-solution flow is a flow that wasn't created inside a solution. As an admin, all you need is a button flow with two Power Automate management connector actions—List Flows as Admin and Restore Deleted Flows as Admin.
As part of this process, in four easy and quick steps, you'll first list deleted flows in an environment using the List flows as Admin action. Then, you'll use the Restore Deleted Flows as Admin action to restore the flow using flowName
property of the flow that you retrieved from the List flows as Admin action.
Build a manual flow with a button trigger.
Add the List Flows as Admin action.
Select New Step.
Search for Power Automate Management Connector or List Flows as Admin action.
Select the List Flows as Admin action.
In the Environment dropdown menu, select the environment the flow was originally deleted from.
In the Include Soft-Deleted Flows dropdown menu, select Yes.
Run the flow to note the
flowName
of the flow you want to retrieve.Run the flow.
Expand the flow run.
Expand the raw OUTPUTS/value of the List Flows as Admin action.
You'll see all the flows in that environment you have access to as an admin, including the ones that are soft deleted.
Using the "displayName" among other flow metadata, identify the flow you're trying to recover and note the name in "name" field.
In the following screenshot, the name of the flow is highlighted in green. You'll use this value for the next step.
Add the Restore Deleted Flows as Admin action and run the flow.
Add the Restore Deleted Flows as Admin action from the Power Automate Management Connector.
In the Flow field, enter the name value from step 3.
Run the flow.
After the run has succeeded, you'll notice that the flow has been restored in a disabled state in the environment it was originally deleted from.
Restore deleted flows with PowerShell
In this section, you'll learn about how to restore deleted flows using PowerShell.
Prerequisites for PowerShell
- You must install the latest version of PowerShell cmdlets for Power Apps.
- You must be an environment admin.
- There must be an execution policy set on your device to run PowerShell scripts.
Open PowerShell with elevated privileges to begin.
Install the latest version of PowerShell cmdlets for Power Apps.
Sign in to your Power Apps environment.
Use this command to authenticate to an environment. This command opens a separate window that prompts for your Microsoft Entra authentication details.
Add-PowerAppsAccount
Provide the credentials you want to use to connect to your environment.
Run the following script to get a list of flows in the environment, including flows that were soft-deleted within the past 21 days.
If the
IncludeDeleted
parameter isn't recognized, you might be working with an older version of the PowerShell scripts. Ensure that you're using the latest version of the script modules and retry the steps.Get-AdminFlow -EnvironmentName 41a90621-d489-4c6f-9172-81183bd7db6c -IncludeDeleted $true //To view examples: Get-Help Get-AdminFlow -Examples
Tip
Navigate to the URL of any of the flows in your environment to get your environment name (https://make.powerautomate.com/Environments/<EnvironmentName>/flows) which is required for subsequent steps. Don't omit the prefixed words in the URL if your environment name contains it, for example, Default-8ae09283902-....
Optionally, you can filter the list of flows if you know part of the name of the deleted flow whose flowID you want to find. To do this, use a script similar to this one that finds all flows (including flows that were soft-deleted) in environment 3c2f7648-ad60-4871-91cb-b77d7ef3c239 that contain the string "Testing" in their display name. 256fe2cd306052f68b89f96bc6be643
Get-AdminFlow Testing -EnvironmentName 3c2f7648-ad60-4871-91cb-b77d7ef3c239 -IncludeDeleted $true
Make a note of the
FlowName
value of the flow you want to restore from the previous step.Run the following script to restore the soft-deleted flow with
FlowName
value as 4d1f7648-ad60-4871-91cb-b77d7ef3c239 in an environment named Default-55abc7e5-2812-4d73-9d2f-8d9017f8c877.Restore-AdminFlow -EnvironmentName Default-55abc7e5-2812-4d73-9d2f-8d9017f8c877 -FlowName 4d1f7648-ad60-4871-91cb-b77d7ef3c239 //To view examples: Get-Help Restore-AdminFlow -Examples
Optionally, you can run the
Restore-AdminFlow
script with the following arguments to restore multiple deleted flows.foreach ($id in @( "4d1f7648-ad60-4871-91cb-b77d7ef3c239", "eb2266a8-67b6-4919-8afd-f59c3c0e4131" )) { Restore-AdminFlow -EnvironmentName Default-55abc7e5-2812-4d73-9d2f-8d9017f8c877 -FlowName $id; Start-Sleep -Seconds 1 }