Restore Deleted Flow That Isn’t Part Of A Solution Using PowerShell

If you or someone else accidentally deletes a flow that isn’t part of a solution, you can use PowerShell to restore it within 28 days of deletion.

 Prerequisites

 Note

  • After you restore a flow, it defaults to the disabled state. You must manually enable the flow, per your requirements.
  • The below steps in this article apply only to non-solution flows. If you deleted a flow that was part of a solution, you need to create a support ticket with Microsoft for assistance.
  • Flows that have been deleted more than 28 days ago can’t be recovered, with neither PowerShell script nor with Microsoft support.

Open Windows PowerShell

  • 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 Azure Active Directory (AAD) 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 28 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 <environment id> -IncludeDeleted $true
    //To view examples: Get-Help Get-AdminFlow -Examples
  • Note down the flow name which you want to restore and run the below script:
    Restore-AdminFlow -EnvironmentName <environment id> -FlowName <flow id>
     //To view examples: Get-Help Restore-AdminFlow -Examples

I hope this was helpful!