Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 2.55 KB

powershell-backup-restore-diff-sub.md

File metadata and controls

51 lines (35 loc) · 2.55 KB
title description author tags ms.assetid ms.topic ms.date ms.author ms.custom
PowerShell: Restore backup to another subscription
Learn how to use Azure PowerShell to automate deployment and management of App Service. This sample shows how to restore a backup in another subscription.
msangapu-msft
azure-service-management
a2a27d94-d378-4c17-a6a9-ae1e69dc4a72
sample
12/06/2022
msangapu
mvc, devx-track-azurepowershell

Restore a web app from a backup in another subscription using PowerShell

This sample script retrieves a previously completed backup from an existing web app and restores it to a web app in another subscription.

If needed, install the Azure PowerShell using the instruction found in the Azure PowerShell guide, and then run Connect-AzAccount to create a connection with Azure.

Sample script

[!INCLUDE updated-for-az]

[!code-azurepowershell-interactivemain]

Clean up deployment

If you don't need the web app anymore, use the following command to remove the resource group, web app, and all related resources.

Remove-AzResourceGroup -Name $resourceGroupName -Force

Script explanation

This script uses the following commands. Each command in the table links to command specific documentation.

Command Notes
Add-AzAccount Adds an authenticated account to use for Azure Resource Manager cmdlet requests.
Get-AzWebAppBackupList Gets a list of backups for a web app.
Get-AzWebAppBackup Gets a backup for a web app using the backup ID.
Get-AzWebAppBackupConfiguration Gets the backup configuration for a web app.
New-AzWebApp Creates a web app
Restore-AzWebAppBackup Restores a web app from a previously completed backup.

Next steps

For more information on the Azure PowerShell module, see Azure PowerShell documentation.

Additional Azure PowerShell samples for Azure App Service Web Apps can be found in the Azure PowerShell samples.