1

Is it possible to create an Azure Resource Manager template that sets up the automated backup of a Web App in Azure App Service?

I have everything else for the web sites set up through ARM, but I am stumped on getting automatic backup set up.

I have dug up the documentation for setting it through the REST Api
https://azure.microsoft.com/en-us/documentation/articles/websites-csm-backup/

So currently I can see two options.

Scripting the above REST api calls:
This I can of course script my way out of, but I would really like to do it through an arm template.

Manual through the portal:
This is not really feasible in any kind of automatic repeatable way.

Would really prefer an ARM solution.

juvchan
  • 6,113
  • 2
  • 22
  • 35
Rasmus
  • 556
  • 3
  • 19
  • Scripting REST api calls is not that straightforward. Azure starts complaining about apiVersion and Authorization token, which are not described. Have you found a way around? – Sparrow_ua Apr 06 '16 at 18:45
  • No I haven't had the time to look into this sadly – Rasmus Apr 08 '16 at 12:25

1 Answers1

0

No you cannot, but you can use PowerShell to do so.

UPDATE: Unfortunately the resources are not available in the docs anymore. I am using the Edit-AzureRmWebAppBackupConfiguration command like this:

$resourceGroupName = "backup"
$storageAccountName = "abc"
$blobContainerName = "def"
$startDate = (Get-Date).Date.AddMinutes(45).AddDays(1) # when should the first backup be triggered

$storageKeys = Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageName
$storageContext = New-AzureStorageContext -StorageAccountName $storageName -StorageAccountKey $storageKeys[1].Value
$sasToken = New-AzureStorageContainerSASToken -Name $blobContainerName -Permission rwdl -Context $context -FullUri -ExpiryTime ([DateTime]::MaxValue)
Edit-AzureRmWebAppBackupConfiguration -Name $appName -ResourceGroupName $resourceGroupName `
        -StorageAccountUrl $sasToken -FrequencyInterval 1 -FrequencyUnit Day -RetentionPeriodInDays 7 `
        -KeepAtLeastOneBackup -StartTime $startDate
david
  • 859
  • 1
  • 13
  • 23
  • The link points to a page that describes how to do it on Azure's portal, there's nothing about how to script it with PowerShell – Vlax Sep 26 '17 at 16:24