【Azure Developer】Azure REST API: 如何通过 API查看 Recovery Services Vaults(恢复保管库)的备份策略信息? 如备份中是否含有虚拟机的Disk

问题描述

如何通过 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 - Listhttps://docs.microsoft.com/zh-cn/rest/api/backup/backup-protected-items/list#uri-parameters

Azure China developer guidehttps://docs.azure.cn/en-us/articles/guidance/developerdifferences?toc=%2fguides%2fdeveloper%2ftoc.json#check-endpoints-in-azure

posted @ 2021-07-21 20:51  路边两盏灯  阅读(149)  评论(0编辑  收藏  举报