Home > Software engineering >  Query whether Azure App Services has backup setup
Query whether Azure App Services has backup setup

Time:10-29

Can anyone suggestion a way to query App Services backup status? For example, Let say I have a lot of App Services in Azure, different resource groups, instead of clicking through each one and check if backup is setup or not. I want to have a query so I can execute it and return the result?

Thanks in advance.

CodePudding user response:

Based on the above shared requirement , we have written the below PowerShell script to pull the backup details of a webapp. the below script will check whether if there is backup enabled or not for a particular web under resource group.

  • if backup not enabled scrip will through an error --> Get-AzWebAppBackupConfiguration : Operation returned an invalid status code 'NotFound'
  • if backup is enabled scrip will return --> webappName,storageaccounturi of the backup where it is stored
$RGName='<ResourceGroupName>' ##Pass your ResourceGroupName 

$list= Get-AzWebApp -ResourceGroupName $RGName

$listarray=$list

foreach($list in $listarray){
    $config=Get-AzWebAppBackupConfiguration -ResourceGroupName $RGName -Name $list.name

    Write-Host $config.Name,$config.StorageAccountUrl| Format-Table -AutoSize
}

Here is the sample output for reference:

enter image description here

  • Related