从Azure命令行复制托管磁盘快照到不同的区域

4

我正在尝试使用Azure命令行将托管磁盘快照复制到不同的区域,但出现以下错误 - "未找到实体"

这是我正在使用的命令 az snapshot create --resource-group test-azstdsouthcentral --name testcopy3 --location WestUS2 --source /subscriptions/xxx/resourceG roups/test-azstdsouthcentral/providers/Microsoft.Compute/snapshots/testcopy

是否支持将托管磁盘快照复制到另一个区域?

1个回答

6

是否支持将托管磁盘快照复制到另一个区域?

不支持将快照创建到不同的区域。

但您可以先将快照创建到同一区域,然后将该快照作为VHD复制到不同区域中的存储帐户,最后从VHD创建托管磁盘。

示例脚本:

#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

请参考此链接了解有关将托管快照导出/复制为VHD到不同区域存储帐户的更多信息:link
请参考此链接了解有关从VHD创建托管磁盘的更多信息:link

这对你有用吗?如果需要更多帮助,请告诉我 :) - Jason Ye

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接