There are many different reasons to move Azure VMs from one region to another.
• Operation Requirements – As an example, if organization open a branch in different region and want to move some operations to them, it is best to move infrastructure resource to the same geographical location as it will improve the reliability and availability of the services.
• Compliance requirements – Sometimes rules and regulations force businesses to keep the data/operations in the same country or continent.
• Azure feature requirements – Sometimes new Azure services & features are the first rollout to certain regions. If your current region has such limitations and still wants to use those features/services, you will need to move the resource to a supported region.
In this post, I am going to demonstrate how to move Azure VM from one region to another using Azure site recovery.
Before start lets make sure we have the following in place,
• Valid Subscription – Subscription should support to create resources in the target region. It also should have enough credit.
• Account Permission – We need to make sure we have enough permissions to create virtual machines, storage accounts, virtual networks in Azure.
• Network layout – Make sure to check the source network setup including all the components such as NSG, public IP, load balancer. The failover process will create a virtual network automatically to match the source network. But we have to create all other resources manually after the migration.
• Compatible regions – Make sure the source and target regions are part of compatible list https://docs.microsoft.com/en-gb/azure/site-recovery/azure-to-azure-support-matrix#region-support
In this demo, I am going to create windows server 2019 VM in East US region and then move it West US region using Azure site recovery.
Create Source VM
1. Launch PowerShell console and connect to Azure using Connect-AzAccount
[su_note]Please make sure you have Azure PowerShell module installed. More info about it can find under https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-2.6.0[/su_note]
2. Create a new resource group using,
New-AzResourceGroup -Name REBELRG -Location "East US"
In the above, REBELRG is the resource group name and East US is the resource group location.
3. Then create a new VM using,
$mylogin = Get-Credential
New-AzVm -ResourceGroupName REBELRG -Name "REBELVM01" -Location "East US" -VirtualNetworkName "REBELVNET1" -SubnetName "REBELVMSubnet1" -PublicIpAddressName "REBELVM01IP1" -OpenPorts 80,3389 -Image win2019datacenter -Size Standard_D2s_v3 -Credential $mylogin
In the above, REBELVM01 is the VM name. It is running windows server 2019 data center edition. I have specified it using -Image parameter. It also using Standard_D2s_v3 vm size.