How to create vm using custom image from different storage account, on Azure

前端 未结 5 1662
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 11:39

I\'m currently using this template to create a vm by custom image. For the OS Disk part:

\"storageProfile\": {
  \"osDisk\": {
    \"name\": \"[concat(variab         


        
5条回答
  •  南笙
    南笙 (楼主)
    2021-01-14 12:02

    It is a requirement that the source image and the destination vhd reside in the same storage account, however it is not required that the storage account be in the same resource group as the VM. It must be in the same region/location, but does not have to be in the same resource group.

    So you can set up a storage account beforehand, put your source image in there and not have to worry about copying it during deployment, that will happen automatically. Here's a snippet of how I configure my templates:

    "userImageName":"[concat('http://',parameters('userImageStorageAccountName'),'.blob.core.windows.net/',parameters('userImageStorageContainerName'),'/',parameters('userImageVhdName'))]",
    "osDiskVhdContainer": "[concat('http://',parameters('userImageStorageAccountName'),'.blob.core.windows.net/',parameters('vmImageStorageContainerName'),'/')]"
    

    Same storage account but different containers for images and vhds.

    So make sure:

    1. source and dest are in the same storageAccount
    2. VM and storage are in the same region (e.g. East Asia)
    3. use a new storage account (provisioned by ARM) not "classic"

提交回复
热议问题