Restoring a deleted cloud flow that isn’t part of a solution using PowerShell requires interacting with the Power Automate Management connectors via PowerShell. Here’s a breakdown of the process and the necessary steps:
Important Considerations:
- Recovery Window: There’s a limited window for restoring deleted flows. After a certain period (typically 30 days), the flow is permanently deleted.
- Permissions: You’ll need appropriate permissions within your Power Automate environment to perform these actions.
- Module Installation: Ensure you have the
Microsoft.PowerApps.Administration.PowerShellandMicrosoft.PowerApps.PowerShellmodules installed.
Steps:
- Connect to Power Apps: PowerShell
Add-PowerAppsAccountThis command will prompt you to authenticate with your Power Apps credentials. - Get Deleted Flows: PowerShell
Get-AdminFlow -EnvironmentName "YourEnvironmentName" -DeletedReplace"YourEnvironmentName"with the actual name of your Power Automate environment. This command retrieves a list of deleted flows within that environment. - Identify the Flow:
- Examine the output of the
Get-AdminFlowcommand. - Look for the flow you want to restore.
- Note the
FlowName(the flow’s GUID).
- Examine the output of the
- Restore the Flow: PowerShell
Restore-AdminFlow -EnvironmentName "YourEnvironmentName" -FlowName "FlowGUID"Replace"YourEnvironmentName"with your environment name and"FlowGUID"with theFlowNameyou noted in the previous step.
Example:
PowerShell
Add-PowerAppsAccount
$environmentName = "MyDevEnvironment"
$deletedFlows = Get-AdminFlow -EnvironmentName $environmentName -Deleted
if ($deletedFlows) {
Write-Host "Deleted Flows:"
$deletedFlows | Format-Table DisplayName, FlowName, LastModifiedTime
$flowToRestore = Read-Host "Enter the FlowName (GUID) of the flow to restore"
Restore-AdminFlow -EnvironmentName $environmentName -FlowName $flowToRestore
Write-Host "Flow restored successfully."
} else {
Write-Host "No deleted flows found."
}
Explanation:
- The script first connects to your Power Apps account.
- It then retrieves the list of deleted flows in the specified environment.
- It displays the deleted flows, including their names and GUIDs.
- The user is then prompted to enter the GUID of the flow to restore.
- Finally, the
Restore-AdminFlowcommand is used to restore the selected flow. - It also includes error handeling, to ensure that if no deleted flows are found, it informs the user.
Important Notes:
- Ensure you have the correct environment name and flow GUID.
- The restoration process might take some time, depending on the complexity of the flow.
- It is best practice to always add your flows to solutions, this makes them much easier to manage, and backup.
- If you are having issues with the powershell modules, ensure that they are up to date.
By following these steps, you can restore deleted cloud flows that are not part of a solution using PowerShell.


Leave a comment