Generation 1 Azure VM restore to new VM fails with CloudInternalError

42 Views Asked by At

I'm having a problem restoring a gen 1 Azure VM to a new (gen 1) VM. This new VM will exist in a different resource group (in a different Azure location), and that resource group contains the virtual network for the new VM. As you can see in the code below (written in PowerShell), I'm getting the most recent recovery point from the recovery services vault in question, and then using that for the restore operation.

# Get the most recent recovery point name
[string]$rpName = az backup recoverypoint list --resource-group $vm.resourceGroup `
    --vault-name $vm.vaultName `
    --backup-management-type 'AzureIaasVM' `
    --container-name $vm.vmName `
    --item-name $vm.vmName `
    --query '[0].name' `
    --output 'tsv'

Write-Output "Restoring $($vm.vmName) to $($vm.targetVmName)"
az backup restore restore-disks --resource-group $vm.resourceGroup `
    --vault-name $vm.vaultName `
    --container-name $vm.vmName `
    --item-name $vm.vmName `
    --restore-mode 'AlternateLocation' `
    --storage-account $storageAccountName `
    --storage-account-resource-group $storageAccountRg `
    --target-resource-group $vm.targetVnetResourceGroup `
    --rp-name $rpName `
    --target-vm-name $vm.targetVmName `
    --target-vnet-name $vm.targetVnetName `
    --target-vnet-resource-group $vm.targetVnetResourceGroup `
    --target-subnet-name $vm.targetSubnetName

This will kick off a restore that I can monitor in the Backup Center. After about 20 minutes, the restore status will change to Completed with warnings. If I drill into the backup job, the error code I see is CloudInternalError with the following warning message: Microsoft Azure Backup encountered an internal error.

The job itself consists of 2 sub-tasks:

  1. Transfer data from vault.
  2. Create the restored virtual machine

The first step completes, but the second is where the error happens. The storage account being used for the restore is a Standard_LRS, StorageV2 account.

Where am I going wrong here?

1

There are 1 best solutions below

0
Disco Globeulon On BEST ANSWER

I managed to figure out the issue with the restore. So the issue here is that the storage account and virtual network were both in a region that wasn't the failover / secondary region for the one that the original VM resides. So, in this case, since the VM and Recovery Services Vault lived in East US 2, the infrastructure for the new VM either has also live in East US 2 or the paired region, which is Central US.

So, if I recreate my infrastructure in the Central US region, and add the --use-secondary-region flag to the az backup restore restore-disks call, then the restore both registers correctly as a Cross Region restore in the Backup Center, and it completes successfully. Note that Cross Region restore must be enabled in the Recovery Services Vault for this to work.