【问题标题】:Query whether Azure App Services has backup setup查询 Azure App Services 是否有备份设置
【发布时间】:2021-12-13 05:01:51
【问题描述】:

谁能建议一种查询应用服务备份状态的方法? 例如,假设我在 Azure 中有很多应用服务,不同的资源组,而不是单击每个并检查是否设置了备份。我想要一个查询,以便我可以执行它并返回结果?

提前致谢。

【问题讨论】:

标签: azure azure-web-app-service azure-backup-vault


【解决方案1】:

基于上述共享需求,我们编写了以下 PowerShell 脚本来拉取 webapp 的备份详细信息。下面的脚本将检查资源组下的特定网站是否启用了备份。

  • 如果未启用备份,脚本将出现错误 --> Get-AzWebAppBackupConfiguration : Operation returned an invalid status code 'NotFound'
  • 如果启用备份,脚本将返回 --> 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
}

以下是示例输出以供参考:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-11
    • 2020-03-20
    相关资源
    最近更新 更多