This repository was archived by the owner on Dec 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +33
-5
lines changed Expand file tree Collapse file tree 4 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ Get-AzWebAppBackupList -ResourceGroupName $resourceGroupNameSub1 -Name $webAppNa
15
15
# Note the BackupID property of the backup you want to restore
16
16
17
17
# Get the backup object that you want to restore by specifying the BackupID
18
- $backup = (Get-AzWebAppBackupList - ResourceGroupName $resourceGroupNameSub1 - Name $webAppNameSub1 | where {$_.BackupId -eq ' <replace-with-BackupID>' })
18
+ $backup = (Get-AzWebAppBackup - ResourceGroupName $resourceGroupNameSub1 - Name $webAppNameSub1 - BackupId ' <replace-with-BackupID>' )
19
+
20
+ # Get the storage account URL of the backup configuration
21
+ $url = (Get-AzWebAppBackupConfiguration - ResourceGroupName $resourceGroupNameSub1 - Name $webAppNameSub1 ).StorageAccountUrl
19
22
20
23
# Log into the subscription that you want to restore the app to
21
24
Add-AzAccount
@@ -24,4 +27,4 @@ Add-AzAccount
24
27
New-AzWebApp - ResourceGroupName $resourceGroupNameSub2 - AppServicePlan $appServicePlanSub2 - Name $webAppNameSub2 - Location $locationSub2
25
28
26
29
# Restore the app by overwriting it with the backup data
27
- Restore-AzWebAppBackup - ResourceGroupName $resourceGroupNameSub2 - Name $webAppNameSub2 - StorageAccountUrl $backup .StorageAccountUrl - BlobName $backup.BlobName - Overwrite
30
+ Restore-AzWebAppBackup - ResourceGroupName $resourceGroupNameSub2 - Name $webAppNameSub2 - StorageAccountUrl $url - BlobName $backup.BlobName - Overwrite
Original file line number Diff line number Diff line change 1
1
$resourceGroupName = " myResourceGroup"
2
2
$webappname = " <replace-with-your-app-name>"
3
-
3
+ $targetResourceGroupName = " myResourceGroup"
4
+ $targetWebappName = " <replace-with-your-app-name>"
4
5
5
6
# List statuses of all backups that are complete or currently executing.
6
7
Get-AzWebAppBackupList - ResourceGroupName $resourceGroupName - Name $webappname
7
8
8
9
# Note the BackupID property of the backup you want to restore
9
10
10
11
# Get the backup object that you want to restore by specifying the BackupID
11
- $backup = (Get-AzWebAppBackupList - ResourceGroupName $resourceGroupName - Name $webappname | where {$_.BackupId -eq ' <replace-with-BackupID>' })
12
+ $backup = (Get-AzWebAppBackup - ResourceGroupName $resourceGroupName - Name $webappname - BackupId ' <replace-with-BackupID>' )
13
+
14
+ # Get the storage account URL of the backup configuration
15
+ $url = (Get-AzWebAppBackupConfiguration - ResourceGroupName $resourceGroupName - Name $webappname ).StorageAccountUrl
12
16
13
17
# Restore the app by overwriting it with the backup data
14
- $backup | Restore-AzWebAppBackup - Overwrite
18
+ Restore-AzWebAppBackup - ResourceGroupName $resourceGroupName - Name $webappname - StorageAccountUrl $url - BlobName $backup .BlobName - Overwrite
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ New-AzWebAppSlot -Name $webappname -ResourceGroupName myResourceGroup `
26
26
$PropertiesObject = @ {
27
27
repoUrl = " $gitrepo " ;
28
28
branch = " master" ;
29
+ isManualIntegration = " true" ; # remove isManualIntegration for continuous deployment from a GitHub repo you own
29
30
}
30
31
Set-AzResource - PropertyObject $PropertiesObject - ResourceGroupName myResourceGroup `
31
32
- ResourceType Microsoft.Web/ sites/ slots/ sourcecontrols `
Original file line number Diff line number Diff line change @@ -6,5 +6,25 @@ cd $gitdirectory
6
6
# Create a web app and set up Git deployement.
7
7
New-AzWebApp - Name $webappname
8
8
9
+ # Configure GitHub deployment from your GitHub repo and deploy once.
10
+ $PropertiesObject = @ {
11
+ scmType = " LocalGit" ;
12
+ }
13
+ Set-AzResource - Properties $PropertiesObject - ResourceGroupName $webappname `
14
+ - ResourceType Microsoft.Web/ sites/ config - ResourceName $webappname / web `
15
+ - ApiVersion 2015 - 08 - 01 - Force
16
+
17
+ # Get publishing profile for the web app
18
+ $xml = [xml ](Get-AzWebAppPublishingProfile - Name $webappname `
19
+ - ResourceGroupName $webappname `
20
+ - OutputFile null)
21
+
22
+ # Extract connection information from publishing profile
23
+ $username = $xml.SelectNodes (" //publishProfile[@publishMethod=`" MSDeploy`" ]/@userName" ).value
24
+ $password = $xml.SelectNodes (" //publishProfile[@publishMethod=`" MSDeploy`" ]/@userPWD" ).value
25
+
26
+ # Set git remote
27
+ git remote add azure https:// ${username} :$password @$webappname.scm.azurewebsites.net :443 / $webappname.git
28
+
9
29
# Push your code to the new Azure remote
10
30
git push azure master
You can’t perform that action at this time.
0 commit comments