forked from Azure/azure-docs-powershell-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30d0f63
commit 77c8876
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
app-service/backup-restore-diff-sub/backup-restore-diff-sub.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
$resourceGroupNameSub1 = "<replace-with-your-group-name>" | ||
$resourceGroupNameSub2 = "<replace-with-desired-new-group-name>" | ||
$webAppNameSub1 = "<replace-with-your-app-name>" | ||
$webAppNameSub2 = "<replace-with-desired-new-app-name>" | ||
$appServicePlanSub2 = "<replace-with-desired-new-plan-name>" | ||
$locationSub2 = "West Europe" | ||
|
||
|
||
# Log into the subscription with the backup | ||
Add-AzureRmAccount | ||
|
||
# List statuses of all backups that are complete or currently executing. | ||
Get-AzureRmWebAppBackupList -ResourceGroupName $resourceGroupNameSub1 -Name $webAppNameSub1 | ||
|
||
# Note the BackupID property of the backup you want to restore | ||
|
||
# Get the backup object that you want to restore by specifying the BackupID | ||
$backup = (Get-AzureRmWebAppBackupList -ResourceGroupName $resourceGroupNameSub1 -Name $webAppNameSub1 | where {$_.BackupId -eq <replace-with-BackupID>}) | ||
|
||
# Log into the subscription that you want to restore the app to | ||
Add-AzureRmAccount | ||
|
||
# Create a new web app | ||
New-AzureRmWebApp -ResourceGroupName $resourceGroupNameSub2 -AppServicePlan $appServicePlanSub2 -Name $webAppNameSub2 -Location $locationSub2 | ||
|
||
# Restore the app by overwriting it with the backup data | ||
Restore-AzureRmWebAppBackup -ResourceGroupName $resourceGroupNameSub2 -Name $webAppNameSub2 -StorageAccountUrl $backup.StorageAccountUrl -BlobName $backup.BlobName -Overwrite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
$resourceGroupName = "myResourceGroup" | ||
$webappname = "<replace-with-your-app-name>" | ||
|
||
|
||
# List statuses of all backups that are complete or currently executing. | ||
Get-AzureRmWebAppBackupList -ResourceGroupName $resourceGroupName -Name $webappname | ||
|
||
# Note the BackupID property of the backup you want to restore | ||
|
||
# Get the backup object that you want to restore by specifying the BackupID | ||
$backup = Get-AzureRmWebAppBackup -ResourceGroupName $resourceGroupName -Name $webappname ` | ||
-BackupId <replace-with-BackupID> | ||
$backup = (Get-AzureRmWebAppBackupList -ResourceGroupName $resourceGroupName -Name $webappname | where {$_.BackupId -eq <replace-with-BackupID>}) | ||
|
||
# Restore the app by overwriting it with the backup data | ||
$backup | Restore-AzureRmWebAppBackup -Overwrite |