Azure 使用 ARM 模板并行创建 40VM
Azure create 40VM in parallel using ARM template
我需要使用 ARM 模板从连接到单个负载均衡器的映像创建 40 个虚拟机。有没有办法指定虚拟机资源的数量?
我不是在寻找比例集解决方案。
您可以将 copyIndex 函数用作 copyIndex(loopName, offset)
。
以下示例显示了复制循环和名称中包含的索引值。
{
"apiVersion": "2018-04-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(parameters('vmNamePrefix'), copyindex())]",
"copy": {
"name": "virtualMachineLoop",
"count": "[variables('numberOfInstances')]"
},
例如,您可以将variables('numberOfInstances')
更改为40,并注意Azure VM名称、osProfile、networkInterfaces等资源在以下参考模板中应具有唯一名称(包括copyIndex()
) .
https://github.com/Azure/azure-quickstart-templates/tree/master/201-2-vms-loadbalancer-lbrules
https://github.com/Azure/azure-quickstart-templates/tree/master/201-2-vms-internal-load-balancer
我需要使用 ARM 模板从连接到单个负载均衡器的映像创建 40 个虚拟机。有没有办法指定虚拟机资源的数量?
我不是在寻找比例集解决方案。
您可以将 copyIndex 函数用作 copyIndex(loopName, offset)
。
以下示例显示了复制循环和名称中包含的索引值。
{
"apiVersion": "2018-04-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(parameters('vmNamePrefix'), copyindex())]",
"copy": {
"name": "virtualMachineLoop",
"count": "[variables('numberOfInstances')]"
},
例如,您可以将variables('numberOfInstances')
更改为40,并注意Azure VM名称、osProfile、networkInterfaces等资源在以下参考模板中应具有唯一名称(包括copyIndex()
) .
https://github.com/Azure/azure-quickstart-templates/tree/master/201-2-vms-loadbalancer-lbrules
https://github.com/Azure/azure-quickstart-templates/tree/master/201-2-vms-internal-load-balancer