Why need Azure VM Backup
We should have a contingency plan for unplanned and planned downtime for VMs running on Azure. There are many solutions such as running VMs in Availability Set, ASR(Azure Site Recovery), and Azure VM Backup(Recovery Service Vault). Some solutions will give high availability, some DR and some will simply backup. You can choose the solution based on your business need, especially RPO and RTO.
Azure VM Backup does an image-level backup of the VM and stores the entire image on Recovery Service Vault. The image can be restored as a VM if you want VM-level recovery or it can be mounted as a drive if you want to file/folder-level recovery. You can do a daily backup, weekly backup, and monthly backup with a retention period of 99 years. More than one daily backup is not available now, if you want more than one restoration point per day then you may go for Azure Backup Server which has no license cost, simply you need to put in a server. This solution might not fit for production VMs but it will be a good solution for development and other auxiliary servers.
In this scenario VM has already been created, see how to create VM using PowerShell.
High-Level Configuration Process
- Prepare Recovery Service Vault and Backup policy
- Backup VM
- Restore entire VM
- Restore only files and folders
Prepare Recovery Service Vault and Backup policy
Here, we have a VM running and we want to back up it to the recovery service vault.
Click on VM and it will show VM information as shown below. Click on the Backup button.
Once you click on the Backup button, it will navigate to Enable backup page and will ask for the Recovery Service Vault name and Backup policy details. we are creating a new recovery service vault, ProdVmVaultwill is the name of the newly created recovery vault.
After that click on Backup policy and define your backup policy as per your requirement.
Now, click on Enable Backup to create a recovery service vault with a defined backup policy.
Once the recovery service vault will be created, you will navigate to the page shown below. To back up the VM click on the Backup now button.
Provide the retention date for the backup and click on the Backup button.
we can see the status of the backup process under Backup jobs.
The backup has successfully completed.
To verify the backup by steps are shown below.
we can see that ProdVmVault has been created under the recovery service vault.
Click on ProdVmVault->Backup items under protected items, we can see one azure VM is there.
Restore the VM
When we click on the VM, it will give you an option for recovery. As we can see there are Restore VM and File Recovery options. Let’s do VM-level recovery first.
It will ask to select a restoration point, here we have only one restoration point that is application consistent.
Provide restore configuration details such as the name of the target VM, resource group, virtual network, subnet, and storage account.
All required information was provided, now click on the Restore button to start the restoration process.
We can see the restoration task in progress under Backup jobs.
The restoration task has successfully completed and VM is created with the backup image. Your VM is ready to use but it will have different public IP. If you have a public DNS record for the server then you need to change it manually.
If you don’t want to recover the entire VM, you only need to recover data and then click on File Recovery.
It will give a script that will mount all the drives to the local computers. You can run the script on any server/computer. The script will ask for a password to connect to the recovery service vault. Download the script as shown below.
Run the script as Administrator, it will trigger PowerShell and ask for a password to connect.
Here, D and H drive has mounted to the local computer and you can recover your data.
We can see files and folders of the drive here, simply we can copy and paste them to any location.
The mounted drive will be automatically dismounted after 12 hours or you can discount it anytime from the portal as shown below.
Azure VM Backup is a solution to protect your VMs running on Azure with some pros and cons. See the Azure Backup Pricing page for information about Backup Pricing.