如何使用不同的存储帐户的自定义形象,在Azure上创建虚拟机 [英] How to create vm using custom image from different storage account, on Azure

查看:200
本文介绍了如何使用不同的存储帐户的自定义形象,在Azure上创建虚拟机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用这模板来通过创建自定义图像虚拟机。对于操作系统磁盘部分:

 storageProfile:{
  或osdisk:{
    名:[CONCAT(变量('VMNAME'),' - 或osdisk'),
    OSTYPE:[参数('OSTYPE'),
    缓存:读写
    createOption:FromImage,
    图片: {
      URI:[变量('userImageName')]
    },
    VHD:{
      URI:[变量('osDiskVhdName')]
    }
  }
}

有没有可能是图像和vhd场存储在不同的存储帐户?

更新

我试图在同一资源组中使用两个存储帐户。但错误信息仍然提到,源和目标存储账户是不同的

在这里输入的形象描述


解决方案

这是源图像和目标VHD驻留在同一个存储账户的要求,但它是的的要求的存储帐户是相同的资源组的VM英寸它必须是在相同的区域/位置,但不必是相同的资源组中的

所以,你可以设立一个存储账户事前,把你的源图像在那里,而不必担心在部署过程中复制它,那将自动发生。下面是我如何配置我的模板的代码段:

<$p$p><$c$c>\"userImageName\":\"[concat('http://',parameters('userImageStorageAccountName'),'.blob.core.windows.net/',parameters('userImageStorageContainerName'),'/',parameters('userImageVhdName'))]\",
osDiskVhdContainer: \"[concat('http://',parameters('userImageStorageAccountName'),'.blob.core.windows.net/',parameters('vmImageStorageContainerName'),'/')]\"

同一存储帐户,但不同的容器图像和虚拟硬盘。

所以一定要确保:


  1. 源和目标都在同一个storageAccount

  2. VM和存储都在同一地区(例如东亚)

  3. 使用新的存储帐户(ARM供应)而不是经典

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

"storageProfile": {
  "osDisk": {
    "name": "[concat(variables('vmName'),'-osDisk')]",
    "osType": "[parameters('osType')]",
    "caching": "ReadWrite",
    "createOption": "FromImage",
    "image": {
      "uri": "[variables('userImageName')]"
    },
    "vhd": {
      "uri": "[variables('osDiskVhdName')]"
    }
  }
}

Is it possible that image and vhd field stored in different storage account?

Update

I try to use two storage account in the same resource group. But the error message still mentions that "source and destination storage accounts are different"

解决方案

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"

这篇关于如何使用不同的存储帐户的自定义形象,在Azure上创建虚拟机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆