现在,使用 az image create 创建 VM 托管映像。 以下示例使用名为 myVM 的 VM 资源在名为 myResourceGroup 的资源组中创建名为 myImage 的映像 。
az image create \
--resource-group myResourceGroup \
--name myImage --source myVM
Note
The image is created in the same resource group as your source VM. You
can create VMs in any resource group within your subscription from this
image. From a management perspective, you may wish to create a specific
resource group for your VM resources and images.
If you are capturing an image of a generation 2 VM, also use the
--hyper-v-generation V2
parameter. for more information, see
Generation 2 VMs.
If you would like to store your image in zone-resilient storage, you
need to create it in a region that supports
availability zones and include
the --zone-resilient true
parameter.
This command returns JSON that describes the VM image. Save this output for later reference.