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

问题描述

如何通过 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值:

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

 

 

 

参考资料

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

上一篇:js 自定义滚动条


下一篇:快速下载vscode的方法