Back to Basics
No matter what hypervisor you use, a virtual machine has a common makeup. There are two components:
- The metadata: A description of the virtual machine, which is what we see and typically works with through administrative tools, such as the Azure Portal.
- The disks: This is everything of value in the virtual machine is kept, such as the operating system, identity, software, OS and software configuration, and the data.
The metadata of an Azure virtual machine is normally of little value, and everything we care about is in the disks. If we lose the metadata, we can recreate it. But that leads us to an issue.
We have had an issue with restoring virtual machines in all but the simplest deployments in Azure. When we restore a virtual machine, we cannot restore membership of an availability set (highly available placement in a single compute cluster) or an availability zone (highly available placement across data centers in a region).
We have had workarounds based on restoring the disks of a virtual machine instead of the whole virtual machine (including the metadata):
- Un-Managed Disks: A JSON file is also restored with the disks in blob storage, and you can deploy the JSON file to recreate the virtual machine, including the availability set/zone membership.
- Managed Disks: We had a process that took more time where we could restore the disks as un-managed disks, convert them to managed disks, create a new virtual machine from the OS disk while restoring the availability set/zone membership, and then add the data disks.
But – that’s messy, so Microsoft has given us something new to simplify the process of recovering an existing virtual machine.
If you want to perform a recovery of a virtual machine that still exists in Azure, then you have a new option to replace the disks. When you select this process, Azure Backup will:
- Recover the disks from backup to a staging location (blob storage in a storage account).
- In parallel, a job runs to back up the virtual machine as it is now, allowing a rollback to be done if later required.
- Once the snapshot of the parallel backup is created, the existing disks of the virtual machine are replaced, reusing the existing metadata of the virtual machine.
- The data of the parallel backup job is copied from the snapshot to the recovery services vault.
By reusing the metadata or configuration of the virtual machine, any membership of an availability set/zone is retained and there is no magic to be done!
How it Works
To start this process you must shut down the virtual machine so that it is a deallocated state in Azure.
You can start the disk recovery process in either one of two places:
- The virtual machine: Browse to Backup (under Operations) and click Restore VM.
- Recovery services vault: Navigate to Backup Items (under Protected Items), click Azure Virtual Machine, and select the virtual machine in question.
Next, you will click the Restore VM button, which will start the Restore process. A Select Restore Point blade appears. Pick the restore point, or backup job, that you want to restore from and click OK.
The Restore Configuration blade opens. Enter the following information:
- Restore Type: Set this to Replace Disk(s)
- Staging Location: Pick the storage account that will be temporarily used to recover the disks from backup.
Click OK to allow Azure to validate the job and then click Restore to launch the restore job. You can track the progress of the jobs (the aforementioned backup and restore jobs) by browsing to Backup Jobs (under Monitoring) in the recovery services vault.
You can start the virtual machine once the restore job (update step) has completed.
What About Restore to a New Machine?
I’m afraid, at this time, you will have to use the previously mentioned workarounds for un-managed and managed disks if you want to restore to a new virtual machine and need to create/retain availability set/zone membership.