Check Azure WebApps have Backup Configured

Azure WebApps (depending on tier) come with an optional native backup service. This quick PowerShell snippet looks at all the WebApps in the current subscription and reports back on whether Backup has been set up. This should be helpful for spotting where a configuration has been missed.

Use Set-AzContext to set the subscription in advance, and to restrict to an individual Resource Group use the –ResourceGroupName on the Get-WebApp cmdlet in the first line.

 1foreach($WebApp in Get-AzWebApp ){
 2 if (Get-AzWebAppBackupConfiguration `
 3    -ResourceGroupName $WebApp.ResourceGroup `
 4    -Name $WebApp.Name `
 5    -ErrorAction SilentlyContinue) {
 6  $WebApp.Name+" Backup Configured"
 7 } else {
 8  if( (Get-Error -Last 1).Exception.Response.Content `
 9    -like "*Backup configuration not found for site*")
10    {$WebApp.Name+" Backup Not Configured"}
11 }
12}