Copie de points de restauration de machines virtuelles d’une région à l’autre
Dans cet article, vous découvrez comment copier des points de restauration de machine virtuelle dans une autre région.
Prérequis
Pour copier un point de restauration dans une région, vous devez précréer une ressource restorePointCollection
dans la région cible.
En savoir plus sur la copie d’une région à l’autre et sa limitation avant de copier des points de restauration.
Créer une collection de points de restauration dans la région cible
La première étape de la copie d’un point de restauration de machine virtuelle existant d’une région à une autre consiste à créer une ressource restorePointCollection
dans la région cible en faisant référence à restorePointCollection
à partir de la région source.
Requête d’URI
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}&api-version={api-version}
Corps de la demande
{
"name": "name of target restorePointCollection resource",
"location": "location of target restorePointCollection resource",
"tags": {
"department": "finance"
},
"properties": {
"source": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}"
}
}
}
Response
La réponse de la requête inclut un code d’état et un ensemble d’en-têtes de réponse.
Code d’état
L’opération retourne 201 pendant la création et 200 pendant la mise à jour.
Corps de réponse
{
"name": "name of the copied restorePointCollection resource",
"id": "CSM Id of copied restorePointCollection resource",
"type": "Microsoft.Compute/restorePointCollections",
"location": "location of the copied restorePointCollection resource",
"tags": {
"department": "finance"
},
"properties": {
"source": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}",
"location": "location of source RPC"
}
}
}
Créer un point de restauration de machine virtuelle dans une région cible
L’étape suivante consiste à déclencher la copie d’un point de restauration dans la ressource RestorePointCollection
cible en référençant le point de restauration dans la région source à copier.
Requête d’URI
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}&api-version={api-version}
Corps de la demande
{
"name": "name of the restore point resource",
"properties": {
"sourceRestorePoint": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"
}
}
}
Remarque
L’emplacement de sourceRestorePoint
est déduit de celui du RestorePointCollection
source.
Response
La réponse de la requête inclut un code d’état et un ensemble d’en-têtes de réponse.
Code d’état
Cette opération est longue. L’opération retourne donc 201 lors de la création. Le client est censé interroger l’état à l’aide de l’opération. Les en-têtes location
et Azure-AsyncOperation
sont fournis à cet effet.
Lors de la création du point de restauration, ProvisioningState
apparaît comme Creating
dans la réponse de l’API du point de restauration GET. En cas d’échec de la création, ProvisioningState
apparaît en tant que Failed
. ProvisioningState
est défini sur Succeeded
le moment où la copie de données entre les régions est lancée.
Remarque
Vous pouvez suivre l’état de copie en appelant l’affichage d’instance GET (?$expand=instanceView
) sur le point de restauration de machine virtuelle cible. Pour savoir comment procéder, consultez la section « Obtenir l’état de copie/réplication des points de restauration de machine virtuelle ». Le point de restauration de machine virtuelle est considéré comme utilisable (peut être utilisé pour restaurer une machine virtuelle) uniquement lorsque la copie de tous les points de restauration de disque s’effectue correctement.
Corps de réponse
{
"id": "CSM Id of the restore point",
"name": "name of the restore point",
"properties": {
"optionalProperties": "opaque bag of properties to be passed to extension",
"sourceRestorePoint": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"
},
"consistencyMode": "CrashConsistent | FileSystemConsistent | ApplicationConsistent",
"sourceMetadata": {
"vmId": "Unique Guid of the VM from which the restore point was created",
"location": "source VM location",
"hardwareProfile": {
"vmSize": "Standard_A1"
},
"osProfile": {
"computername": "",
"adminUsername": "",
"secrets": [
{
"sourceVault": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/providers/Microsoft.KeyVault/vaults/<keyvault-name>"
},
"vaultCertificates": [
{
"certificateUrl": "https://<keyvault-name>.vault.azure.net/secrets/<secret-name>/<secret-version>",
"certificateStore": "certificateStoreName on Windows"
}
]
}
],
"customData": "",
"windowsConfiguration": {
"provisionVMAgent": "true|false",
"winRM": {
"listeners": [
{
"protocol": "http"
},
{
"protocol": "https",
"certificateUrl": ""
}
]
},
"additionalUnattendContent": [
{
"pass": "oobesystem",
"component": "Microsoft-Windows-Shell-Setup",
"settingName": "FirstLogonCommands|AutoLogon",
"content": "<XML unattend content>"
}
],
"enableAutomaticUpdates": "true|false"
},
"linuxConfiguration": {
"disablePasswordAuthentication": "true|false",
"ssh": {
"publicKeys": [
{
"path": "Path-Where-To-Place-Public-Key-On-VM",
"keyData": "PEM-Encoded-public-key-file"
}
]
}
}
},
"storageProfile": {
"osDisk": {
"osType": "Windows|Linux",
"name": "OSDiskName",
"diskSizeGB": "10",
"caching": "ReadWrite",
"managedDisk": {
"id": "CSM Id of the managed disk",
"storageAccountType": "Standard_LRS"
},
"diskRestorePoint": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/restorePointCollections/<rpcName>/restorePoints/<rpName>/diskRestorePoints/<diskRestorePointName>"
}
},
"dataDisks": [
{
"lun": "0",
"name": "datadisk0",
"diskSizeGB": "10",
"caching": "ReadWrite",
"managedDisk": {
"id": "CSM Id of the managed disk",
"storageAccountType": "Standard_LRS"
},
"diskRestorePoint": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/restorePointCollections/<rpcName>/restorePoints/<rpName>/diskRestorePoints/<diskRestorePointName>"
}
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": " http://storageaccount.blob.core.windows.net/"
}
}
},
"provisioningState": "Succeeded | Failed | Creating | Deleting",
"provisioningDetails": {
"creationTime": "Creation Time of Restore point in UTC"
}
}
}
Obtenir l’état de la copie/réplication des points de restauration de la machine virtuelle
Une fois que la copie des points de restauration de machine virtuelle est lancée, vous pouvez suivre l’état de copie en appelant la vue d’instance GET (?$expand=instanceView
) sur le point de restauration de machine virtuelle cible.
Requête d’URI
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}?$expand=instanceView&api-version={api-version}
Response
{
"id": "CSM Id of the restore point",
"name": "name of the restore point",
"properties": {
"optionalProperties": "opaque bag of properties to be passed to extension",
"sourceRestorePoint": {
"id": "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/microsoft.compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"
},
"consistencyMode": "CrashConsistent | FileSystemConsistent | ApplicationConsistent",
"sourceMetadata": {
"vmId": "Unique Guid of the VM from which the restore point was created",
"location": "source VM location",
"hardwareProfile": {
"vmSize": "Standard_A1"
},
"osProfile": {
"computername": "",
"adminUsername": "",
"secrets": [
{
"sourceVault": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/providers/Microsoft.KeyVault/vaults/<keyvault-name>"
},
"vaultCertificates": [
{
"certificateUrl": "https://<keyvault-name>.vault.azure.net/secrets/<secret-name>/<secret-version>",
"certificateStore": "certificateStoreName on Windows"
}
]
}
],
"customData": "",
"windowsConfiguration": {
"provisionVMAgent": "true|false",
"winRM": {
"listeners": [
{
"protocol": "http"
},
{
"protocol": "https",
"certificateUrl": ""
}
]
},
"additionalUnattendContent": [
{
"pass": "oobesystem",
"component": "Microsoft-Windows-Shell-Setup",
"settingName": "FirstLogonCommands|AutoLogon",
"content": "<XML unattend content>"
}
],
"enableAutomaticUpdates": "true|false"
},
"linuxConfiguration": {
"disablePasswordAuthentication": "true|false",
"ssh": {
"publicKeys": [
{
"path": "Path-Where-To-Place-Public-Key-On-VM",
"keyData": "PEM-Encoded-public-key-file"
}
]
}
}
},
"storageProfile": {
"osDisk": {
"osType": "Windows|Linux",
"name": "OSDiskName",
"diskSizeGB": "10",
"caching": "ReadWrite",
"managedDisk": {
"id": "CSM Id of the managed disk",
"storageAccountType": "Standard_LRS"
},
"diskRestorePoint": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/restorePointCollections/<rpcName>/restorePoints/<rpName>/diskRestorePoints/<diskRestorePointName>"
}
},
"dataDisks": [
{
"lun": "0",
"name": "datadisk0",
"diskSizeGB": "10",
"caching": "ReadWrite",
"managedDisk": {
"id": "CSM Id of the managed disk",
"storageAccountType": "Standard_LRS"
},
"diskRestorePoint": {
"id": "/subscriptions/<subId>/resourceGroups/<rgName>/restorePointCollections/<rpcName>/restorePoints/<rpName>/diskRestorePoints/<diskRestorePointName>"
}
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": " http://storageaccount.blob.core.windows.net/"
}
}
},
"provisioningState": "Succeeded | Failed | Creating | Deleting",
"provisioningDetails": {
"creationTime": "Creation Time of Restore point in UTC"
},
"instanceView": {
"statuses": [
{
"code": "ReplicationState/succeeded",
"level": "Info",
"displayStatus": "Replication succeeded"
}
],
"diskRestorePoints": [
{
"id": "<diskRestorePoint Arm Id>",
"replicationStatus": {
"status": {
"code": "ReplicationState/succeeded",
"level": "Info",
"displayStatus": "Replication succeeded"
},
"completionPercent": "<completion percentage of the replication>"
}
}
]
}
}
}
Étapes suivantes
- Créer un point de restauration de machine virtuelle.
- En savoir plus sur les options de sauvegarde et de restauration pour les machines virtuelles dans Azure.