如何将Azure托管磁盘从一个区域移动到另一个区域

1,first we need to create a source storage account for migration.

rgName=roger02location =”East Asia”
storageAccountName=roger1026NewAzureRmResourceGroupNamergName -Location locationNewAzureRmStorageAccountNamestorageAccountName -Location locationSkuNamePremiumLRSResourceGroupNamergName

2,create a new storage account in the region we want to move to.

rgName=roger01location =”West Europe”
storageAccountName=roger109NewAzureRmResourceGroupNamergName -Location locationNewAzureRmStorageAccountNamestorageAccountName -Location locationSkuNamePremiumLRSResourceGroupNamergName

3,create a managed disk under the resource group “roger02” within portal

如何将Azure托管磁盘从一个区域移动到另一个区域

如何将Azure托管磁盘从一个区域移动到另一个区域

如何将Azure托管磁盘从一个区域移动到另一个区域

如何将Azure托管磁盘从一个区域移动到另一个区域

4,execute the rest commands to copy the blob and get a status.

Source storage account

rgName=roger02location =”East Asia”
storageAccountName=roger1026diskName =”rogerdisk”

Target storage account

destrgName=roger01destlocation =”West Europe”
deststorageAccountName=roger109destdiskName =”destrogerdisk”

Assign access to the source disk

sas=GrantAzureRmDiskAccessResourceGroupNamergName -DiskName $diskName -DurationInSecond 3600 -Access Read

saKey=GetAzureRmStorageAccountKeyResourceGroupNamedestrgName -Name deststorageAccountNamestorageContext =New-AzureStorageContext –StorageAccountName deststorageAccountNameStorageAccountKeysaKey[0].Value
New-AzureStorageContainer -Context $storageContext -Name vhds10261

Start-AzureStorageBlobCopy -AbsoluteUri sas.AccessSASDestContainervhds10261DestContextstorageContext -DestBlob $destdiskName

Get-AzureStorageBlobCopyState -Context storageContextBlobdestdiskName -Container vhds10261

Now we only need to wait for the replication process to complete. The above is the steps to migrate the managed disk through the powershell command.

Note:
If the managed disk is attached to the VM, stop the VM and copy it to the storage account.