Creating a managed disk from snapshot in different region (Azure)

烈酒焚心 提交于 2019-12-04 20:45:14
Jason Ye

The snapshot itself is in West US but I want to create a disk in East US. What am I doing wrong?

We can't create a managed disk from snapshot to another location.

If you want to create a managed disk from snapshot to another location, we should export/Copy managed snapshots as VHD to a storage account in different region with PowerShell.

Here the sample script:

#Provide the subscription Id of the subscription where snapshot is created
$subscriptionId = "yourSubscriptionId"

#Provide the name of your resource group where snapshot is created
$resourceGroupName ="yourResourceGroupName"

#Provide the snapshot name 
$snapshotName = "yourSnapshotName"

#Provide Shared Access Signature (SAS) expiry duration in seconds e.g. 3600.
#Know more about SAS here: https://docs.microsoft.com/en-us/azure/storage/storage-dotnet-shared-access-signature-part-1
$sasExpiryDuration = "3600"

#Provide storage account name where you want to copy the snapshot. 
$storageAccountName = "yourstorageaccountName"

#Name of the storage container where the downloaded snapshot will be stored
$storageContainerName = "yourstoragecontainername"

#Provide the key of the storage account where you want to copy snapshot. 
$storageAccountKey = 'yourStorageAccountKey'

#Provide the name of the VHD file to which snapshot will be copied.
$destinationVHDFileName = "yourvhdfilename"


# Set the context to the subscription Id where Snapshot is created
Select-AzureRmSubscription -SubscriptionId $SubscriptionId

#Generate the SAS for the snapshot 
$sas = Grant-AzureRmSnapshotAccess -ResourceGroupName $ResourceGroupName -SnapshotName $SnapshotName  -DurationInSecond $sasExpiryDuration -Access Read 

#Create the context for the storage account which will be used to copy snapshot to the storage account 
$destinationContext = New-AzureStorageContext –StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey  

#Copy the snapshot to the storage account 
Start-AzureStorageBlobCopy -AbsoluteUri $sas.AccessSAS -DestContainer $storageContainerName -DestContext $destinationContext -DestBlob $destinationVHDFileName

#Monitor status
Get-AzureStorageBlobCopyState -Context $destinationContext -Blob $destinationVHDFileName -Container $storageContainerName

More information about it, please refer to this link.

You can simple use azure site recovery and add azure2azure service and replicate you vm's into other cross regions, this will not restart the v, it will install the azure site recovery software inside the vm thats need to be replicated, and this will begain the replication, note in order to faster replicate the vm do use premium managed disks.

Note: If you are replicating something like East US 2 to North Europe, this will not be supported, there is a whole documentation which stats what regions are supported for replication. This is a good method if you want less downtime to copy a managed disks across regions.

There is no need to take snapshots if you are following this method.

Please do let me know if you have any other queries.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!