简体   繁体   中英

Create two different VMs using an ARM template in the same resource group

so I'm pretty new to the whole ARM templates or the IaC concept as a whole. My first project was to create a customized VM deployment with its own NSG rules, script and so on. It was not an issue since the github ARM template sample page is a huge help. Also the documentation is clear on that.

The next project is creating two different VMs in the same RG. I cannot use copy since the VMs have to be named differently (not a problem, since I can use an array), have different sizes (maybe an array, too? idk) and NSG rules (array?). They will share the same vnet though, since they need to talk to each other on a local connection (for security reasons).

Does anyone have any experience to share with this? Maybe using nested templates would suffice?

Anyway, any tips you guys give me, I'll gladly test them and share.

Thanks a lot

If you need to create 2 VM's that are the same except for the name, then you should use Virtual Machine Scale Sets, see: https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/overview

For the name of the VM see: https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-instance-ids

You can also use Copy-Loops inside one ARM template: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/copy-resources

You provide things like the name and the SKUs in an array/map and iterate over those.

were you able to create a template for this, I am looking to deploy 20 vms with different names and sizes. Could you share your template. Many thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM