Azure Backup can protect a virtual machine via backup – Azure Site Recovery (ASR) provides disaster recovery services. The backup job protects the metadata and disks of the virtual machine to long-term storage. This backup can be used to recover the machine, the disks, and even files from the backup storage. Additionally, a workload-specific extension (SQL Server today) can be installed in the machine to protect SQL Server using its own APIs instead of just a machine-based backup.
Each of the ways that you can restore an Azure virtual machine from a backup are generalized into four categories:
- Workloads: Strictly speaking, this is a workload backup and not a virtual machine backup. The backup of a workload is done independently of virtual machine backups.
- Create new virtual machine: Either you want to test a backup by restoring to a new machine, or a virtual machine was accidentally deleted, and you need to replace it.
- Replace existing virtual machine: The virtual machine still exists, but you need to reset it back to the time of a previous backup.
- File recovery: You want to restore one or some files from the disk(s) of the virtual machine.
When you back up a virtual machine, the metadata and disks are protected. This might offer application consistency for workloads such as SQL Server inside a Windows virtual machine, but it does not offer a backup that leverages the APIs of the workload. For example, backing up a machine with SQL Server doesn’t offer point-in-time database restores or log truncation. If you deploy a workload protection plan, you can leverage those APIs and get more advanced levels of backup and restore … for the workload.
Now, the only workload inside an Azure virtual machine that is supported is SQL Server. However, more workloads are planned.
Create New Virtual Machine
There are times when you need to create a new virtual machine from a backup. Maybe you have a process for doing test restores? Maybe you need to generate a copy of a production machine for some research or testing? Or maybe someone deleted the wrong machine and you need to get it back as quickly as possible without invoking a DR (ASR) failover to another region?
There are two options in this type of restore:
- Create Virtual Machine: The virtual machine metadata will be rebuilt and the disks will be restored as before. There is a big gotcha: the recovery will not restore the original machine’s membership of an availability set or availability zone.
- Restore Disks: If you do need to recover a machine to an availability set or availability zone then use this option. The process will restore the disks and create a JSON file (ARM template) in a storage account. A link from the restore job will trigger the deployment of the JSON file and re-create the machine from the disks with optional availability membership – you can also just re-deploy the machine from hand using managed OS disks.
Let’s say a virtual machine has had a massive corruption – once for me it was a MySQL database that was completely un-recoverable and broke a WordPress deployment. If that’s the case you can select this option to replace the disks of an existing virtual machine. This process can be extremely quick, especially if you have an upgraded recovery services vault and you are restoring from a backup job that was done in the last week – the restore is a disk to disk copy within the storage cluster.
Note that the existing metadata of the machine is retained – you are just swapping out the old disks (which are backed up, just in case) for the restored disks.
This is my favorite of the restore options to show to people that are new to Azure because it shows some of the clever things that you can do in an integrated software-defined cloud such as Azure.
If you need to restore one or some files from a backup, then you can choose this option. The process will generate a tool that you can use to securely mount the recovery point using iSCSI. This can be done from any machine, not just the machine that was backed up! For example, if I need to get a file onto my PC, as long as I have permissions, I can generate/download the mounting tool, run it on my PC and recover files … without the lengthy process of restoring a full machine or its disks.
The really nice piece is that this is an iSCSI mounting. So, each volume of the protected disks will appear as volumes in File Manager. You can browse the folder structure, find the files and open them to verify that they are valid for restore: databases can be mounted and media can be streamed. Once you know a file should be restored, you just drag-and-drop.
Note that there are some limitations:
- The maximum restore speed will be 1 GB/hour.
- The maximum restored file size is 10 GB – restore disks as copies for larger files.
- The iSCSI connection will terminate after 12 hours.