Moving Azure Managed Disks between regions and subscriptions

I just had a scenario, where a customer is using VMs in Azure, with Managed Disks. Now, due to different events, they wanted to move their VMs to a different region.  Normally that’s an easy task, copying the blobs from one Storage Account to another. It’s actually the same way to do it Managed Disks just a few different steps. Go to your PowerShell prompt!

Using Grant-AzureRmDiskAccess we can create a SAS URL to export our disk from. You can also do this from the portal, but since we’re using PowerShell for the rest…

I started by creating a new Storage Account in the region they wanted to move to – West Europe:

$rgName = “<resource group name>”
$location = “West Europe”
New-AzureRmStorageAccount -Name $storageAccountName -Location $location -SkuName Premium_LRS -ResourceGroupName 

Next I needed the keys for this Storage Account:

$saKey = Get-AzureRmStorageAccountKey -ResourceGroupName $rgName -Name $storageAccountName

Next, create a Storage Context, which is just a PowerShell object to encapsulate credentials for a Storage Account:

$storageContext = New-AzureStorageContext –StorageAccountName $storageAccountName -StorageAccountKey $saKey[0].Value 

And a container for the vhd files:

New-AzureStorageContainer -Context $storageContext -Name vhds

From there I can create the SAS URL for my Managed Disk:

$diskName = “<diskname>”
$sas = Grant-AzureRmDiskAccess -ResourceGroupName $rgName -DiskName $diskName -DurationInSecond 3600 -Access Read 

Now I have 1 hour to copy my disk, which is fine for me. Using Start-AzureStorageBlobCopy I can then use the SAS URL I just got as my source, and the Storage Context to access the destination:

Start-AzureStorageBlobCopy -AbsoluteUri $sas.AccessSAS -DestContainer vhds -DestContext $storageContext -DestBlob $diskName

This will finish *quick*, but don’t be fooled. The command only starts a job to copy the blob. To get a status, you can use:

Get-AzureStorageBlobCopyState -Context $storageContext -Blob $diskName -Container vhds

It will output something like:

CopyId            : 38ad189f-9c91-4d2d-ba42-2eb248a42d37
CompletionTime    :
Status            : Pending
Source            :
BytesCopied       : 817053696
TotalBytes        : 137438953984
StatusDescription :

Now it’s just a matter of waiting for it to finish, and you can create the VM in the destination region. All of the above can also be used to move between subscriptions, a feature that is not yet available for Managed Disks.

One Response to Moving Azure Managed Disks between regions and subscriptions


    The procedure you describe in this post will move a Managed Disk to a storage account, can’t I move a Managed Disks to another Managed Disks in another subscription? Thank you, nice post.

Let me hear your opinion