Checking Azure App Service Backup

While we are in the process of automating our Azure deployments, one item that keeps me awake at nights is backups. What if someone deploys an app to Azure but completely forgets to setup and automated backup?

I had some time last night to (finally) address this problem and came up with the following code:

Login-AzureRmAccount

$sites = Get-AzureRmResource | Where-Object {$_.ResourceType -eq "Microsoft.Web/sites"}

foreach ($site in $sites)
{
    $backup = Get-AzureRmWebAppBackupConfiguration -Name $site.Name -ResourceGroupName $site.ResourceGroupName

    if (-Not $backup.Enabled) {
        Write-Host "NOT ENABLED FOR " $site.Name
    }
}

At the moment, there is still a login prompt where I have to manually authenticate with my Azure subscription info. I'll be working on automating this in the future.