Restoring a standalone (non-solution) canvas app using PowerShell involves leveraging the Power Apps Administration PowerShell module. Here’s a breakdown of the process:
Prerequisites:
- PowerShell Modules: Ensure you have the
Microsoft.PowerApps.Administration.PowerShellandMicrosoft.PowerApps.PowerShellmodules installed. - Permissions: You must have appropriate permissions to manage canvas apps in your Power Apps environment.
Steps:
- Connect to Power Apps: PowerShell
Add-PowerAppsAccountThis command will prompt you to authenticate with your Power Apps credentials. - Get Deleted Apps: PowerShell
Get-AdminApp -EnvironmentName "YourEnvironmentName" -DeletedReplace"YourEnvironmentName"with the actual name of your Power Apps environment. This command retrieves a list of deleted canvas apps within that environment. - Identify the App:
- Examine the output of the
Get-AdminAppcommand. - Locate the app you want to restore.
- Note the
AppName(the app’s GUID).
- Examine the output of the
- Restore the App: PowerShell
Restore-AdminApp -EnvironmentName "YourEnvironmentName" -AppName "AppGUID"Replace"YourEnvironmentName"with your environment name and"AppGUID"with theAppNameyou noted in the previous step.
Example:
PowerShell
Add-PowerAppsAccount
$environmentName = "MyDevEnvironment"
$deletedApps = Get-AdminApp -EnvironmentName $environmentName -Deleted
if ($deletedApps) {
Write-Host "Deleted Canvas Apps:"
$deletedApps | Format-Table DisplayName, AppName, LastModifiedTime
$appToRestore = Read-Host "Enter the AppName (GUID) of the app to restore"
Restore-AdminApp -EnvironmentName $environmentName -AppName $appToRestore
Write-Host "Canvas app restored successfully."
} else {
Write-Host "No deleted canvas apps found."
}
Explanation:
- The script begins by connecting to your Power Apps account.
- It then retrieves a list of deleted canvas apps from the specified environment.
- It displays the deleted apps, including their display names and GUIDs.
- The user is prompted to enter the GUID of the app to restore.
- The
Restore-AdminAppcommand is used to restore the selected app. - The script also includes error handeling, to inform the user if no deleted apps are found.
Important Notes:
- Ensure you have the correct environment name and app GUID.
- The restoration process might take some time.
- It is always best practice to add canvas apps into solutions, so they are easier to manage, and backup.
- Keep your PowerShell modules up to date.
By following these steps, you can effectively restore deleted standalone canvas apps using PowerShell.


Leave a comment