问题描述
如何通过 API查看 Recovery Services Vaults(恢复保管库)的备份策略信息? 如备份中是否含有虚拟机的Disk。在Azure门户中可以通过查看Backup Item查看 (Home --> Recovery Services Vaults --> Backup Items --> Backup Items)
问题回答
查看Azure的REST API 文档,可以通过 Backup Protected Items - List 接口来获取信息:接口的功能为提供保管库中备份的所有项的可分页列表。调用方式为:
中国区微软云(China Azure)
GET https://management.chinacloudapi.cn/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}
/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems?api-version=2021-02-10
##如果需要携带参数
GET https://management.chinacloudapi.cn/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}
/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems?api-version=2021-02-10&$filter={$filter}&$skipToken={$skipToken}
国际版微软云(Global Azure)
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}
/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems?api-version=2021-02-10
##如果需要携带参数
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}
/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems?api-version=2021-02-10&$filter={$filter}&$skipToken={$skipToken}
调用Backup Protected Items接口的返回JSON文件中,包含Extended Properties属性(Azure IaasVM 备份的扩展属性)。此内容中就包含了VM的备份项,如Disk信息。
如测试结果中的IsInclusionList值:
参考资料
Backup Protected Items - List:https://docs.microsoft.com/zh-cn/rest/api/backup/backup-protected-items/list#uri-parameters
Azure China developer guide:https://docs.azure.cn/en-us/articles/guidance/developerdifferences?toc=%2fguides%2fdeveloper%2ftoc.json#check-endpoints-in-azure
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
标签: 如备份中是否含有虚拟机的Disk, API查看 Recovery Services Vaults(恢复保管库)的备份策略信息, Azure REST API: