Parag Chapre

Restore deleted flows

If you or someone else accidentally deletes a flow that is not part of a solution, you can use PowerShell to restore it within 28 days of deletion. Microsoft announced the capability to restore a flow (outside of a solution) with the latest version of the PowerApps Administration cmdlet.

As an admin, you can now use PowerShell to restore a flow you deleted or on behalf of someone in your company without having to file a support ticket with Microsoft.

Prerequisites

Restore deleted flow

1. Open PowerShell with the System admin rights.

2. Install the latest version of PowerShell cmdlets for Power Apps.

3. Once, latest version installed then type below command to authenticate your Power Platform 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 28 days.

If the IncludeDeleted parameter is not recognized, you might be working with an older version of the PowerShell scripts. Ensure that you are 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-AdminFlow

6. Optionally, you can filter the list of flows if you know part of the name of the deleted flow whose FlowName value you want to find. To do this, use a script similar to this one that finds all flows (including those that were soft deleted) in environment 3c2f7648-ad60-4871-91cb-b77d7ef3c239 that contain the string “Testing” in their display name.

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

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 }

If you like this article, feel free to share it with others who might find it helpful! If you have any questions, feel free to reach out to me.

Leave a Reply

Your email address will not be published. Required fields are marked *