Replicate Azure Virtual Machines to Another Region for Disaster Recovery
In this post, I will show you how to enable disaster recovery replication of Azure virtual machines (VMs) from one region to another region. This will enable your services to survive a massive outage in an Azure data center or region.
Note that this service is in preview at the time of writing this article, so the UI is very likely to change by the time of general availability.
The Source Machines
In my demo lab, I have deployed two ARM VMs in a resource group called petri-rg in the Azure North Europe region.
Note that at this time there is no support for:
VMs running Windows Server 2016Microsoft recently added support for WS2016 virtual machines
- VMs with managed disks
I want to enable replication of these VMs to another region. I have to choose from a region that is in the same geographic cluster as my VMs in North Europe:
Create Recovery Services Vault
I am going to replicate my VMs to West Europe. Here, I will create a recovery services vault in a resource group that is also in West Europe.
All we have now in the “disaster recovery site” (a resource group in the West Europe region) is a recovery services vault.
Replicate Virtual Machines
Open the recovery services vault and click + Replicate. In Source:
- Select Azure as the source.
- Select the region where the running virtual machines are, which is North Europe for me.
- Select the deployment model, which is Resource Manager in my example.
- Select the source resource group, which is petri-rg in my case.
In Virtual Machines, select the VMs that you want to replicate with a common replication policy. If you need multiple policies, then you can return to this wizard again.
Note that the VMs must have a provisioned Azure VM Agent. This extension might not be active yet if you have recently deployed the VMs. The agent will be required to provision the Azure Site Recovery Mobility Service as an extension in the guest OS of the VMs.
Things such as storage accounts, availability sets, and virtual networks must be deployed in the disaster recovery region to allow VMs to failover to that region. By default, the original names are re-used with a -asr suffix to create a failover resource group and the required resources. You can customize the destination resource group in the Configure Settings screen:
- You can select a destination resource group and virtual network if they already exist in the region.
- You can select an availability set (if required) if it already exists in the region.
- You can select storage accounts for the virtual machines if they already exist in the region.
You can use the default replication policy or customize it:
- Name: This is what the policy is called.
- Recovery point retention: This is how many hourly recovery points will be retained. The maximum is 24 hours.
- How often an application consistent (VSS) snapshot will be created: This is not important for non-database workloads. Things like SQL Server are actually pretty tolerant. A consistent snapshot becomes one of your (up to 24) recovery points.
At the end of the wizard, click Create Target Resources. Azure will validate the configuration. If all goes well, the resources will be deployed to the disaster recovery site. Wait for the Enable Replication button and click it. The Azure Site Recovery Mobility Service extension will be deployed into the VMs and an initial sync will start. After the initial sync, you have a VM that can be failed over and regular continuous or asynchronous replication will begin.