If you are running virtual machines in Microsoft Azure, and you want to make sure that your servers are protected from downtime, there are multiple things you want to have a look in terms of availability. You will need to make sure that you have the necessary uptime you need within the Azure region your virtual machines are running. For this, we have availability features like different storage options, like Premium Storage, which provides single instance VMs with a 99.9% SLA. And Availability Sets and Availability Zones, which help spread virtual machine groups like domain controllers across the datacenter or even multiple zones within the same region. In many cases, you also want to protect virtual machines from a region outage. For this, we have Azure Site Recovery (ASR), which allows you to asynchronously replicate Azure virtual machines across different Azure Regions and fail them over to the other region if needed.
Let’s have a quick look at ASR, the cross-region disaster recovery (DR) feature for Azure virtual machines.
Set up disaster recovery for Azure VMs
Setting up Azure Site Recovery for an Azure virtual machine (VM) can be reasonably simple. In my case, I have a virtual machine running in the West Europe Azure region. Before you get started with setting up disaster recovery for an Azure VM, make sure you planned and designed your environment in the right way. I recommend that you have a look at the following prerequisites:
There are multiple ways how you can set up disaster recovery for an Azure VM; in my case, I will start setting up the replication directly from the source virtual machine I want to replicate. However, you can also set it up from the Azure recovery services vault or using Azure PowerShell or Azure CLI. In the menu I click on Disaster Recovery in the operations group, I can quickly get started. The first set is it will let me choose the available target region, where I want to failover my VM in case of disaster.
As the next step, you will be able to set up some advanced settings. Azure Site Recovery will give you some suggestions and, if needed, will create the resources for you. You will need to have resources in place like storage accounts, virtual networks, resource groups, and so on, which will be necessary if you failover the virtual machine.
This will take a while until the protection is set up, and the initial virtual machine data is replicated.
Failover Azure VMs to another Azure region
After you did set up the virtual machine disaster recovery option as well as the initial replication completed, you can now see some additional information and a graphical view, which helps you to understand how the resources are connected.
You now have two options; you can do a failover, which will do a production failover of your virtual machine. If the source region is still available and the Azure VM is still running, you can also let ASR shutdown the source machine, and replicate the latest changes, so you don’t have any data loss. However, this is only possible if the region with the source VM is still accessible, and if not, ASR will take the latest recovery point.
Being prepared for disaster recovery is excellent. However, you want to make sure you know it is working if you need it. You don’t want to wait until a real disaster strikes to find out if everything is set up correctly. This is what test failover is for. Test failover is a possibility for you to failover the virtual machine to an isolated virtual network on the target region to be able to test the virtual machine and application without any impact on the production deployment.
If you have multiple VMs you want to failover in a specific order and maybe even want to run some additional scripts to completely failover from a region, ASR also provides you with Recovery Plans. Recovery Plans are great for more complex scenarios than just a single virtual machine.
Azure Site Recovery is Azure’s built-in disaster recovery as a service (DRaaS). I showed you how you can set up an Azure to Azure DR plan. However, you can also use Azure Site Recovery to replicate on-premises servers to Azure for DR. If you want to know more about ASR, I recommend that you read the following links and if you have any questions, please let me know in the comments.