使用 REST API 還原 Azure 虛擬機器
使用 Azure 備份完成 Azure 虛擬機器的備份後,您可以從相同的備份複本還原整個 Azure 虛擬機器、磁碟或檔案。 本文說明如何使用 REST API 還原 Azure VM 或磁碟。
對於任何還原作業,您必須先識別相關的復原點。
選取復原點
使用列出復原點 REST API,可以列出備份項目可用的復原點。 這是一項具備所有相關值的簡單 GET 作業。
GET https://management.azure.com/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints?api-version=2019-05-13
{containerName}
和 {protectedItemName}
的建構方式在這裡。 {fabricName}
為 Azure
。
GET URI 具備所有必要參數。 不需要額外的要求本文。
回覆
名稱 | 類型 | 描述 |
---|---|---|
200 OK | RecoveryPointResourceList | 確定 |
範例回應
一旦提交 GET URI,就會傳回 200 (確定) 回應。
HTTP/1.1 200 OK
Pragma: no-cache
X-Content-Type-Options: nosniff
x-ms-request-id: 03453538-2f8d-46de-8374-143ccdf60f40
x-ms-client-request-id: c48f4436-ce3f-42da-b537-12710d4d1a24; c48f4436-ce3f-42da-b537-12710d4d1a24
Strict-Transport-Security: max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-reads: 14998
x-ms-correlation-request-id: 03453538-2f8d-46de-8374-143ccdf60f40
x-ms-routing-request-id: SOUTHINDIA:20180604T071851Z:03453538-2f8d-46de-8374-143ccdf60f40
Cache-Control: no-cache
Date: Mon, 04 Jun 2018 07:18:51 GMT
Server: Microsoft-IIS/8.0
X-Powered-By: ASP.NET
{
"value": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/microsoft.recoveryservices/vaults/testVault/backupFabrics/Azure/protectionContainers/iaasvmcontainer;iaasvmcontainerv2;testRG;testVM/protectedItems/VM;testRG;testVM/recoveryPoints/20982486783671",
"name": "20982486783671",
"type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints",
"properties": {
"objectType": "IaasVMRecoveryPoint",
"recoveryPointType": "AppConsistent",
"recoveryPointTime": "2018-06-04T06:06:00.5121087Z",
"recoveryPointAdditionalInfo": "",
"sourceVMStorageType": "NormalStorage",
"isSourceVMEncrypted": false,
"isInstantIlrSessionActive": false,
"recoveryPointTierDetails": [
{
"type": 1,
"status": 1
},
{
"type": 2,
"status": 1
}
],
"isManagedVirtualMachine": true,
"virtualMachineSize": "Standard_A1_v2",
"originalStorageAccountOption": false
}
},
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/microsoft.recoveryservices/vaults/testVault/backupFabrics/Azure/protectionContainers/iaasvmcontainer;iaasvmcontainerv2;testRG;testVM/protectedItems/VM;testRG;testVM/recoveryPoints/23358112038108",
"name": "23358112038108",
"type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints",
"properties": {
"objectType": "IaasVMRecoveryPoint",
"recoveryPointType": "CrashConsistent",
"recoveryPointTime": "2018-06-03T06:20:56.3043878Z",
"recoveryPointAdditionalInfo": "",
"sourceVMStorageType": "NormalStorage",
"isSourceVMEncrypted": false,
"isInstantIlrSessionActive": false,
"recoveryPointTierDetails": [
{
"type": 1,
"status": 1
},
{
"type": 2,
"status": 1
}
],
"isManagedVirtualMachine": true,
"virtualMachineSize": "Standard_A1_v2",
"originalStorageAccountOption": false
}
},
......
使用上面回應中的 {name}
欄位可識別復原點。
還原作業
選取相關的還原點之後,請繼續觸發還原作業。
備份項目上的所有還原作業都會使用相同的 POST API 來執行。只有要求本文會隨著還原案例變更。
重要
這裡提到了關於各種還原選項及其相依性的所有詳細資料。 請先檢閱,再繼續觸發這些作業。
觸發還原作業是 POST 要求。 若要深入了解 API,請參閱「觸發還原」REST API。
POST https://management.azure.com/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore?api-version=2019-05-13
{containerName}
和 {protectedItemName}
的建構方式在這裡。 {fabricName}
是 "Azure",而 {recoveryPointId}
是上述復原點的 {name}
欄位。
取得復原點之後,我們必須針對相關的還原案例來建立要求本文。 下列各節概述每個案例的要求本文。
還原回應
還原作業的觸發是非同步作業。 這表示此作業會建立另一項需要個別追蹤的作業。
此作業會傳回兩個回應:建立另一項作業後傳回 202 (已接受),然後是該作業完成後傳回 200 (OK)。
名稱 | 類型 | 描述 |
---|---|---|
202 已接受 | 已接受 |
範例回應
一旦提交 POST URI 以供觸發還原磁碟,初始回應為 202 (已接受) 以及位置標頭或 Azure-async-header。
HTTP/1.1 202 Accepted
Pragma: no-cache
Retry-After: 60
Azure-AsyncOperation: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/microsoft.recoveryservices/vaults/testVault/backupFabrics/Azure/protectionContainers/iaasvmcontainer;iaasvmcontainerv2;testRG;testVM/protectedItems/vm;testRG;testVM/operationsStatus/781a0f18-e250-4d73-b059-5e9ffed4069e?api-version=2019-05-13
X-Content-Type-Options: nosniff
x-ms-request-id: 893fe372-8d6c-4c56-b589-45a95eeef95f
x-ms-client-request-id: a15ce064-25bd-4ac6-87e5-e3bc6ec65c0b; a15ce064-25bd-4ac6-87e5-e3bc6ec65c0b
Strict-Transport-Security: max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1198
x-ms-correlation-request-id: 893fe372-8d6c-4c56-b589-45a95eeef95f
x-ms-routing-request-id: SOUTHINDIA:20180604T130003Z:893fe372-8d6c-4c56-b589-45a95eeef95f
Cache-Control: no-cache
Date: Mon, 04 Jun 2018 13:00:03 GMT
Location: https://management.azure.com/subscriptions//subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/microsoft.recoveryservices/vaults/testVault/backupFabrics/Azure/protectionContainers/iaasvmcontainer;iaasvmcontainerv2;testRG;testVM/protectedItems/vm;testRG;testVM/operationResults/781a0f18-e250-4d73-b059-5e9ffed4069e?api-version=2019-05-13
X-Powered-By: ASP.NET
然後,使用位置標頭或 Azure-AsyncOperation 標頭搭配簡單的 GET 命令,來追蹤所產生的作業。
GET https://management.azure.com/subscriptions//subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/microsoft.recoveryservices/vaults/testVault/backupFabrics/Azure/protectionContainers/iaasvmcontainer;iaasvmcontainerv2;testRG;testVM/protectedItems/vm;testRG;testVM/operationResults/781a0f18-e250-4d73-b059-5e9ffed4069e?api-version=2019-05-13
當作業完成時,它會傳回 200 (確定) 以及回應本文中所產生還原作業的識別碼。
HTTP/1.1 200 OK
Pragma: no-cache
X-Content-Type-Options: nosniff
x-ms-request-id: ea2a8011-eb83-4a4b-9ed2-e694070a966a
x-ms-client-request-id: a7f3a144-ed80-41ee-bffe-ae6a90c35a2f; a7f3a144-ed80-41ee-bffe-ae6a90c35a2f
Strict-Transport-Security: max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-reads: 14973
x-ms-correlation-request-id: ea2a8011-eb83-4a4b-9ed2-e694070a966a
x-ms-routing-request-id: SOUTHINDIA:20180604T130917Z:ea2a8011-eb83-4a4b-9ed2-e694070a966a
Cache-Control: no-cache
Date: Mon, 04 Jun 2018 13:09:17 GMT
Server: Microsoft-IIS/8.0
X-Powered-By: ASP.NET
{
"id": "781a0f18-e250-4d73-b059-5e9ffed4069e",
"name": "781a0f18-e250-4d73-b059-5e9ffed4069e",
"status": "Succeeded",
"startTime": "2018-06-04T13:00:03.8068176Z",
"endTime": "2018-06-04T13:00:03.8068176Z",
"properties": {
"objectType": "OperationStatusJobExtendedInfo",
"jobId": "3021262a-fb3a-4538-9b37-e3e97a386093"
}
}
由於還原作業是長時間執行的作業,所以應該如使用 REST API 監視作業文件所述,進行追蹤。
還原磁碟
如果需要自訂從備份資料建立 VM,您只要將磁碟還原至所選的儲存體帳戶,並根據其需求從這些磁碟建立 VM。 儲存體帳戶應該與復原服務保存庫位於相同的區域中,且不得為區域備援。 磁碟以及已備份 VM 的設定 ("vmconfig.json") 會儲存在指定的儲存體帳戶中。 如上所述,以下提供還原磁碟的相關要求本文。
建立要求本文
若要觸發從 Azure VM 備份還原磁碟,以下是要求本文的元件。
名稱 | 類型 | 描述 |
---|---|---|
內容 | IaaSVMRestoreRequest | RestoreRequestResourceProperties |
如需要求本文的完整定義清單及其他詳細資訊,請參閱觸發還原 REST API 文件。
範例要求
下列要求本文會定義觸發磁碟還原所需的屬性。
{
"properties": {
"objectType": "IaasVMRestoreRequest",
"recoveryPointId": "20982486783671",
"recoveryType": "RestoreDisks",
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testVM",
"storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Storage/storageAccounts/testAccount",
"region": "westus",
"createNewCloudService": false,
"originalStorageAccountOption": false,
"encryptionDetails": {
"encryptionEnabled": false
}
}
}
選擇性復原磁碟
如果您選擇性地備份磁碟,則會在復原點摘要和詳細回應 (英文) 中提供目前備份的磁碟清單。 您也可以選擇性地還原磁碟,也可以在這裡提供更多詳細資料。 若要在備份磁碟清單中選擇性地還原磁碟,請從復原點回應中找出磁碟的 LUN,並將 restoreDiskLunList 屬性新增至上述的要求本文,如下所示。
{
"properties": {
"objectType": "IaasVMRestoreRequest",
"recoveryPointId": "20982486783671",
"recoveryType": "RestoreDisks",
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testVM",
"storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Storage/storageAccounts/testAccount",
"region": "westus",
"createNewCloudService": false,
"originalStorageAccountOption": false,
"encryptionDetails": {
"encryptionEnabled": false
},
"restoreDiskLunList" : [0]
}
}
依照上述說明追蹤回應,並完成長時間執行的作業後,磁碟和已備份虛擬機器的設定 ("VMConfig.json") 會出現在指定的儲存體帳戶中。
取代已備份虛擬機器中的磁碟
雖然還原磁碟會從復原點建立磁碟,但取代磁碟會將備份 VM 的目前磁碟取代為復原點的磁碟。 如上所述,以下提供取代磁碟的相關要求本文。
建立要求本文
若要從 Azure VM 備份觸發磁碟取代,以下是要求本文的元件。
名稱 | 類型 | 描述 |
---|---|---|
內容 | IaaSVMRestoreRequest | RestoreRequestResourceProperties |
如需要求本文的完整定義清單及其他詳細資訊,請參閱觸發還原 REST API 文件。
範例要求
下列要求本文會定義觸發磁碟還原所需的屬性。
{
"properties": {
"objectType": "IaasVMRestoreRequest",
"recoveryPointId": "20982486783671",
"recoveryType": "OriginalLocation",
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testVM",
"storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Storage/storageAccounts/testAccount",
"region": "westus",
"createNewCloudService": false,
"originalStorageAccountOption": false,
"affinityGroup": "",
"diskEncryptionSetId": null,
"subnetId": null,
"targetDomainNameId": null,
"targetResourceGroupId": null,
"targetVirtualMachineId": null,
"virtualNetworkId": null
}
}
還原為另一部虛擬機器
如上所述,下列要求本文會定義觸發虛擬機器還原所需要的屬性。
{
"properties": {
"objectType": "IaasVMRestoreRequest",
"recoveryPointId": "348916168024334",
"recoveryType": "AlternateLocation",
"sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testVM",
"targetVirtualMachineId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/targetRG/providers/Microsoft.Compute/virtualmachines/targetVM",
"targetResourceGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/targetRG",
"storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Storage/storageAccounts/testingAccount",
"virtualNetworkId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/targetRG/providers/Microsoft.Network/virtualNetworks/testNet",
"subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/targetRG/providers/Microsoft.Network/virtualNetworks/testNet/subnets/default",
"region": "westus",
"createNewCloudService": false,
"originalStorageAccountOption": false,
"encryptionDetails": {
"encryptionEnabled": false
}
}
}
處理回應的方式應該如同上述的還原磁碟。
跨區域還原
如果在您用來保護 VM 的保存庫上已啟用跨區域還原 (CRR),則會將備份資料複寫到次要地區。 您可以使用備份資料來執行還原作業。 若要使用 REST API 在次要地區中觸發還原作業,請遵循下列步驟:
選取次要地區中的復原點
您可以使用適用於 CRR 的清單復原點 REST API,列出次要地區中備份項目的可用復原點。 這是具有所有相關值的簡單 GET 作業。
GET https://management.azure.com/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints?api-version=2018-12-20
{containerName}
和 {protectedItemName}
的建構方式在這裡。 {fabricName}
為 Azure
。
GET URI 具備所有必要參數。 不需要額外的要求本文。
注意
如需取得次要地區中的復原點,請使用如上述範例所示的 API 版本 2018-12-20。
回覆
名稱 | 類型 | 描述 |
---|---|---|
200 OK | RecoveryPointResourceList | 確定 |
範例回應
一旦提交 GET URI,就會傳回 200 (確定) 回應。
Headers:
Pragma : no-cache
X-Content-Type-Options : nosniff
x-ms-request-id : bfc4a4e6-c585-46e0-8e38-f11a86093701
x-ms-client-request-id : 4344a9c2-70d8-482d-b200-0ca9cc498812,4344a9c2-70d8-482d-b200-0ca9cc498812
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-resource-requests: 149
x-ms-correlation-request-id : bfc4a4e6-c585-46e0-8e38-f11a86093701
x-ms-routing-request-id : SOUTHINDIA:20210731T112441Z:bfc4a4e6-c585-46e0-8e38-f11a86093701
Cache-Control : no-cache
Date : Sat, 31 Jul 2021 11:24:40 GMT
Server : Microsoft-IIS/10.0
X-Powered-By : ASP.NET
Body:
{
"value": [
{
"id":
"/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/Microsoft.RecoveryServices/vaults/testVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;testRG1;testVM/protectedItems/VM;iaasvmcontainerv2;testRG1;testVM/recoveryPoints/932895704780058094",
"name": "932895704780058094",
"type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints",
"properties": {
"objectType": "IaasVMRecoveryPoint",
"recoveryPointType": "CrashConsistent",
"recoveryPointTime": "2021-07-31T09:24:34.687561Z",
"recoveryPointAdditionalInfo": "",
"sourceVMStorageType": "PremiumVMOnPartialPremiumStorage",
"isSourceVMEncrypted": false,
"isInstantIlrSessionActive": false,
"recoveryPointTierDetails": [
{
"type": 1,
"status": 1
}
],
"isManagedVirtualMachine": true,
"virtualMachineSize": "Standard_D2s_v3",
"originalStorageAccountOption": false,
"osType": "Windows"
}
},
{
"id":
"/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/Microsoft.RecoveryServices/vaults/testVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;testRG1;testVM/protectedItems/VM;iaasvmcontainerv2;testRG1;testVM/recoveryPoints/932891484644960954",
"name": "932891484644960954",
"type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints",
"properties": {
"objectType": "IaasVMRecoveryPoint",
"recoveryPointType": "CrashConsistent",
"recoveryPointTime": "2021-07-30T09:20:01.8355052Z",
"recoveryPointAdditionalInfo": "",
"sourceVMStorageType": "PremiumVMOnPartialPremiumStorage",
"isSourceVMEncrypted": false,
"isInstantIlrSessionActive": false,
"recoveryPointTierDetails": [
{
"type": 1,
"status": 1
},
{
"type": 2,
"status": 1
}
],
"isManagedVirtualMachine": true,
"virtualMachineSize": "Standard_D2s_v3",
"originalStorageAccountOption": false,
"osType": "Windows"
}
},
.....
使用上面回應中的 {name}
欄位可識別復原點。
取得存取權杖
若要執行跨區域還原,您將需要存取權杖來授權您的要求,以存取次要地區中複寫的還原點。 若要取得存取權杖,請遵循下列步驟:
步驟 1:
使用 AAD 屬性 API 來對次要地區 (下列範例中的 westus) 取得 AAD 屬性:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/westus/backupAadProperties?api-version=2018-12-20
回應範例
回應會以下列格式傳回:
{
"properties": {
"tenantId": "00000000-0000-0000-0000-000000000000",
"audience": "https://RecoveryServices/IaasCoord/aadmgmt/wus",
"servicePrincipalObjectId": "00000000-0000-0000-0000-000000000000"
}
}
步驟 2:
使用取得存取權杖 API 來授權您的要求,以存取次要地區中的複寫還原點:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken?api-version=2018-12-20
至於要求本文,請貼上在上個步驟中 AAD 屬性 API 所傳回的回應內容。
{
"properties": {
"tenantId": "00000000-0000-0000-0000-000000000000",
"audience": "https://RecoveryServices/IaasCoord/aadmgmt/wus",
"servicePrincipalObjectId": "00000000-0000-0000-0000-000000000000"
}
}
回應範例
回應會以下列格式傳回:
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/Microsoft.RecoveryServices/vaults/testVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;testRG1;testVM/protectedItems/VM;iaasvmcontainerv2;testRG1;testVM/recoveryPoints/26083826328862",
"name": "932879774590051503",
"type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints",
"properties": {
"objectType": "CrrAccessToken",
"accessTokenString": "<access-token-string>",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"resourceGroupName": "testVaultRG",
"resourceName": "testVault",
"resourceId": "000000000000000000",
"protectionContainerId": 000000,
"recoveryPointId": "932879774590051503",
"recoveryPointTime": "7/26/2021 3:35:36 PM",
"containerName": "iaasvmcontainerv2;testRG1;testVM",
"containerType": "IaasVMContainer",
"backupManagementType": "AzureIaasVM",
"datasourceType": "VM",
"datasourceName": "testvm1234",
"datasourceId": "000000000000000000",
"datasourceContainerName": "iaasvmcontainerv2;testRG1;testVM",
"coordinatorServiceStampUri": "https://pod01-coord1.eus.backup.windowsazure.com",
"protectionServiceStampId": "00000000-0000-0000-0000-000000000000",
"protectionServiceStampUri": "https://pod01-prot1h-int.eus.backup.windowsazure.com",
"tokenExtendedInformation": "<IaaSVMRecoveryPointMetadataBase xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" i:type=\"IaaSVMRecoveryPointMetadata_V2015_09\" xmlns=\"http://windowscloudbackup.com/CloudCommon/V2011_09\"><MetadataVersion>V2015_09</MetadataVersion><ContainerType i:nil=\"true\" /><InstantRpGCId>ef4ab5a7-c2c0-4304-af80-af49f48af3d1;AzureBackup_testvm1234_932843259176972511;AzureBackup_20210726_033536;AzureBackupRG_eastus_1</InstantRpGCId><IsBlockBlobEnabled>true</IsBlockBlobEnabled><IsManagedVirtualMachine>true</IsManagedVirtualMachine><OriginalSAOption>false</OriginalSAOption><OsType>Windows</OsType><ReadMetadaFromConfigBlob i:nil=\"true\" /><RecoveryPointConsistencyType>CrashConsistent</RecoveryPointConsistencyType><RpDiskDetails i:nil=\"true\" /><SourceIaaSVMRPKeyAndSecret i:nil=\"true\" /><SourceIaaSVMStorageType>PremiumVMOnPartialPremiumStorage</SourceIaaSVMStorageType><VMSizeDescription>Standard_D2s_v3</VMSizeDescription><Zones xmlns:d2p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" i:nil=\"true\" /></IaaSVMRecoveryPointMetadataBase>",
"rpTierInformation": {
"InstantRP": "Valid",
"HardenedRP": "Valid"
},
"rpOriginalSAOption": false,
"rpIsManagedVirtualMachine": true,
"rpVMSizeDescription": "Standard_D2s_v3",
"bMSActiveRegion": "EastUS"
}
}
將磁碟還原至次要地區
使用跨區域還原觸發 API,將項目還原至次要地區。
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore?api-version=2018-12-20
要求本文應該有兩個部分:
crossRegionRestoreAccessDetails:貼上「取得存取權杖 API 要求」(上一個步驟的執行內容) 回應中的「屬性」區塊,以填入要求本文的此區段。
restoreRequest:若要填入要求本文的 restoreRequest 區段,您必須傳遞先前取得的復原點識別碼,以及來源 VM 的 Azure Resource Manager (ARM) 識別碼,以及次要地區中要做為暫存位置的儲存體帳戶詳細資料。 若要執行磁碟還原,請將 RestoreDisks 指定為復原類型。
以下是將 VM 磁碟還原至次要地區的範例要求本文:
{
"crossRegionRestoreAccessDetails": {
"objectType": "CrrAccessToken",
"accessTokenString": "<access-token-string>",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"resourceGroupName": "azurefiles",
"resourceName": "azurefilesvault",
"resourceId": "000000000000000000",
"protectionContainerId": 000000,
"recoveryPointId": "932879774590051503",
"recoveryPointTime": "7/26/2021 3:35:36 PM",
"containerName": "iaasvmcontainerv2;testRG1;testVM",
"containerType": "IaasVMContainer",
"backupManagementType": "AzureIaasVM",
"datasourceType": "VM",
"datasourceName": "testvm1234",
"datasourceId": "000000000000000000",
"datasourceContainerName": "iaasvmcontainerv2;testRG1;testVM",
"coordinatorServiceStampUri": "https://pod01-coord1.eus.backup.windowsazure.com",
"protectionServiceStampId": "00000000-0000-0000-0000-000000000000",
"protectionServiceStampUri": "https://pod01-prot1h-int.eus.backup.windowsazure.com",
"tokenExtendedInformation": "<IaaSVMRecoveryPointMetadataBase xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" i:type=\"IaaSVMRecoveryPointMetadata_V2015_09\" xmlns=\"http://windowscloudbackup.com/CloudCommon/V2011_09\"><MetadataVersion>V2015_09</MetadataVersion><ContainerType i:nil=\"true\" /><InstantRpGCId>ef4ab5a7-c2c0-4304-af80-af49f48af3d1;AzureBackup_testvm1234_932843259176972511;AzureBackup_20210726_033536;AzureBackupRG_eastus_1</InstantRpGCId><IsBlockBlobEnabled>true</IsBlockBlobEnabled><IsManagedVirtualMachine>true</IsManagedVirtualMachine><OriginalSAOption>false</OriginalSAOption><OsType>Windows</OsType><ReadMetadaFromConfigBlob i:nil=\"true\" /><RecoveryPointConsistencyType>CrashConsistent</RecoveryPointConsistencyType><RpDiskDetails i:nil=\"true\" /><SourceIaaSVMRPKeyAndSecret i:nil=\"true\" /><SourceIaaSVMStorageType>PremiumVMOnPartialPremiumStorage</SourceIaaSVMStorageType><VMSizeDescription>Standard_D2s_v3</VMSizeDescription><Zones xmlns:d2p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" i:nil=\"true\" /></IaaSVMRecoveryPointMetadataBase>",
"rpTierInformation": {
"InstantRP": "Valid",
"HardenedRP": "Valid"
},
"rpOriginalSAOption": false,
"rpIsManagedVirtualMachine": true,
"rpVMSizeDescription": "Standard_D2s_v3",
"bMSActiveRegion": "EastUS"
},
"restoreRequest": {
"affinityGroup": "",
"createNewCloudService": false,
"encryptionDetails": {
"encryptionEnabled": false
},
"objectType": "IaasVMRestoreRequest",
"recoveryPointId": "932879774590051503",
"recoveryType": "RestoreDisks",
"sourceResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG1/providers/Microsoft.Compute/virtualMachines/testVM",
"targetResourceGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG1",
"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG1/providers/Microsoft.Storage/storageAccounts/testStorageAccount",
"region": "westus",
"affinityGroup": "",
"createNewCloudService": false,
"originalStorageAccountOption": false,
"restoreDiskLunList": []
}
}
類似主要區域還原作業,這是非同步作業,需要個別追蹤。
下一步
如需 Azure 備份 REST API 的詳細資訊,請參閱下列文件:
- Azure 復原服務提供者 REST API
- Get started with Azure REST API (開始使用 Azure REST API)