Reputation: 404
I am trying to copy a managed disk snapshot to different region using the Azure command line and it fails with the following error - "The entity was not found"
Here is the command I am using az snapshot create --resource-group test-azstdsouthcentral --name testcopy3 --location WestUS2 --source /subscriptions/xxx/resourceG roups/test-azstdsouthcentral/providers/Microsoft.Compute/snapshots/testcopy
Is it supported to copy a managed disk snapshot to a separate region?
Upvotes: 4
Views: 3873
Reputation: 13954
Is it supported to copy a managed disk snapshot to a separate region?
You can't create snapshot to different region.
But you can create snapshot to the same region, then copy the snapshot as VHD to a storage account in different region, then create a managed disk from a VHD.
Sample script:
#Provide the subscription Id where snapshot is created
subscriptionId=dd80b94e-0463-4a65-8d04-c94f403879dc
#Provide the name of your resource group where snapshot is created
resourceGroupName=myResourceGroupName
#Provide the snapshot name
snapshotName=mySnapshotName
#Provide Shared Access Signature (SAS) expiry duration in seconds e.g. 3600.
#Know more about SAS here: https://learn.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=mystorageaccountname
#Name of the storage container where the downloaded snapshot will be stored
storageContainerName=mystoragecontainername
#Provide the key of the storage account where you want to copy snapshot.
storageAccountKey=mystorageaccountkey
#Provide the name of the VHD file to which snapshot will be copied.
destinationVHDFileName=myvhdfilename
az account set --subscription $subscriptionId
sas=$(az snapshot grant-access --resource-group $resourceGroupName --name $snapshotName --duration-in-seconds $sasExpiryDuration --query [accessSas] -o tsv)
az storage blob copy start --destination-blob $destinationVHDFileName --destination-container $storageContainerName --account-name $storageAccountName --account-key $storageAccountKey --source-uri $sas
More information about export/copy managed snapshots as VHD to a storage account in different region, please refer to this link.
More information about create a managed disk from a VHD, please refer to this link.
Upvotes: 6