如何使用自定义镜像部署多个虚拟机?

how to deploy multiple virtual machines using custom image?

我正在使用 Azure。 我创建了 Linux 虚拟机的自定义映像。 我必须创建自定义映像的多个虚拟机。 但是我不知道该怎么做。 在资源管理器门户中,'virtual machine scale out' 功能仅适用于 OS 图像(不适用于自定义图像)。 不过,我更喜欢在门户中完成的解决方案,使用 Azure CLI 或使用模板对我来说没问题。

有一个名为 201-vmss-windows-customimage 的 azure-quickstart-template 将为您提供一个模板来实现您的方案。

来自readme.md

The template allows a URL to a custom image to be provided as a parameter at run time. The custom image should be contained in a storage account which is in the same location as the VM Scale Set is created in, in addtion the storage account which contains the image should also be under the same subscription that the scale set is being created in.

更新:如果您的自定义图片是基于Linux,您需要在template中修改osType。修改为Linux,另存为名称test.json。您可以执行以下 cmdlet。

New-AzureRmResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName mygroup -TemplateFile C:\Users\shui\Desktop\test.json

这是我在实验室进行的测试。

此外,您可以使用此 Deployment template for autoscaled custom image vmss

This template allows you to deploy an autoscaled VM Scale Set of Linux VMs based of an existing custom image. The load balancers and vms should be assigned public IPs