【Azure Developer】Azure REST API: 如何通過 API檢視 Recovery Services Vaults(恢復保管庫)的備份策略資訊? 如備份中是否含有虛擬機器的Disk
阿新 • • 發佈:2021-07-21
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 - 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
當在複雜的環境中面臨問題,格物之道需:濁而靜之徐清,安以動之徐生。 雲中,恰是如此!