This post is a reference for needing to move an Azure Managed Disk between regions. It is based on this Microsoft Docs article.
There are legacy posts containing information to use Az PowerShell to basically do a disk export to blob storage (with a vhd file) and then import that.
This procedure skips those intermediate steps, and uses AzCopy to do it directly.
If there’s no active data changing on the disk, you could consider taking a snapshot and then producing a new Managed Disk from your snapshot to perform the steps below – this way you wouldn’t need to turn off the VM using the Disk. However, the situations where this might be viable are probably rare.
You will need to:
- Download the latest version of AzCopy v10 and make sure it is in your path
- Install Azure PowerShell module.
First, shut down and deallocate your VM.
Then open a PowerShell terminal and connect to your Azure subscription.
Then populate this script, and execute each command in sequence.
# Name of the Managed Disk you are starting with $sourceDiskName = "testweb1_c" # Name of the resource group the source disk resides in $sourceRG = "test-centralus-rg" # Name you want the destination disk to have $targetDiskName = "testweb1_c" # Name of the resource group to create the destination disk in $targetRG = "test-eastus2-rg" # Azure region the target disk will be in $targetLocate = "EastUS2" # Gather properties of the source disk $sourceDisk = Get-AzDisk -ResourceGroupName $sourceRG -DiskName $sourceDiskName # Create the target disk config, adding the sizeInBytes with the 512 offset, and the -Upload flag $targetDiskconfig = New-AzDiskConfig -SkuName 'Premium_LRS' -UploadSizeInBytes $($sourceDisk.DiskSizeBytes+512) -Location $targetLocate -CreateOption 'Upload' # Create the target disk (empty) $targetDisk = New-AzDisk -ResourceGroupName $targetRG -DiskName $targetDiskName -Disk $targetDiskconfig # Get a SAS token for the source disk, so that AzCopy can read it $sourceDiskSas = Grant-AzDiskAccess -ResourceGroupName $sourceRG -DiskName $sourceDiskName -DurationInSecond 86400 -Access 'Read' # Get a SAS token for the target disk, so that AzCopy can write to it $targetDiskSas = Grant-AzDiskAccess -ResourceGroupName $targetRG -DiskName $targetDiskName -DurationInSecond 86400 -Access 'Write' # Begin the copy! .\azcopy copy $sourceDiskSas.AccessSAS $targetDiskSas.AccessSAS --blob-type PageBlob # Revoke the SAS so that the disk can be used by a VM Revoke-AzDiskAccess -ResourceGroupName $sourceRG -DiskName $sourceDiskName # Revoke the SAS so that the disk can be used by a VM Revoke-AzDiskAccess -ResourceGroupName $targetRG -DiskName $targetDiskName
When you get to the AzCopy step, you should see results something like this:
In my experience, the transfer will go as fast as the slowest rated speed for your managed disk – the screenshot above was from a Premium P15 disk (256 GB) rated at 125 MBps (or ~ 1 Gbps).