Last active
April 17, 2017 22:52
-
-
Save mathieu-benoit/f3d6b1b2d330c4fe11dbf37b475745ec to your computer and use it in GitHub Desktop.
Restore-WebApp-Backup-On-Slot
This file contains hidden or 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
Param( | |
[string] [Parameter(Mandatory=$true)] $SubscriptionId, | |
[string] [Parameter(Mandatory=$true)] $ResourceGroupName, | |
[string] [Parameter(Mandatory=$true)] $WebAppName, | |
[string] [Parameter(Mandatory=$true)] $SlotName, | |
[string] [Parameter(Mandatory=$true)] $StorageAccountName, | |
[string] [Parameter(Mandatory=$true)] $ContainerName, | |
[string] [Parameter(Mandatory=$true)] $BlobFileName | |
) | |
Login-AzureRmAccount; | |
Select-AzureRmSubscription -SubscriptionId $SubscriptionId; | |
$storageAccountKey = Get-AzureRmStorageAccountKey -ResourceGroupName $ResourceGroupName -Name $StorageAccountName; | |
$context = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $storageAccountKey[0].Value; | |
$sasUrl = New-AzureStorageContainerSASToken -Name $ContainerName -Permission rwdl -Context $context -ExpiryTime (Get-Date).AddDays(1) -FullUri; | |
Restore-AzureRmWebAppBackup -ResourceGroupName $ResourceGroupName -Name $WebAppName -Slot $SlotName -StorageAccountUrl $sasUrl -BlobName $BlobFileName -Overwrite; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment