Recover Deleted MS Flows.
If a non-solution or solution flow is accidentally deleted by you or someone else, it can be restored within 21 days of its deletion.
Restore deleted flows with the Power Automate Management connector
Using Power Automate, you have the capability to restore a deleted solution flow or non-solution flow within a 21-day window after deletion. A non-solution flow refers to a flow that was not initially created within a solution.
As an administrator, you can achieve this by creating a button flow containing two crucial
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.
1) Build a manual flow with a button trigger.
2) Add the List Flows as Admin action.
3) Run the flow to note the flowName of the flow you want to retrieve.
4) Add the Restore Deleted Flows as Admin action and run the flow.
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
1) Open PowerShell with elevated privileges to begin.
2) Install the latest version of PowerShell cmdlets for Power Apps.
3) Sign in to your Power Apps environment.
Add-PowerAppsAccount
4) Provide the credentials you want to use to connect to your environment.
5) 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
Note: 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-..
6. 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
7) Make a note of the FlowName value of the flow you want to restore from the previous step.
8) 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
9) 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 }
Conclusion:
If you or someone else accidentally deletes a non-solution or solution flow, you can restore it within 21 days of deletion.