ARM template to create multiple VMs having different VM Sizes and OS.

Ramesh R 1 Reputation point

I am looking for a generic ARM template that can create multiple VMs each having different VM Size and OS image. Plan is to pass VM names, VM Sizes and OS configurations as parameter arrays to the ARM template during deployment. Template linking is a solution but I am more interested in implementing a template that can loop itself to create multiple resources.

Azure DevTest Labs
Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
261 questions
Azure Lab Services
Azure Lab Services
An Azure service that is used to set up labs for classrooms, trials, development and testing, and other scenarios.
285 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Samara Soucy - MSFT 21 Reputation points

    This is possible using the copy property in the template where you want to make use of your parameter array.

    A simple example is something like this:

    "parameters": {  
      "org": {  
        "type": "array",  
        "defaultValue": [  
    "resources": [  
        "name": "[concat('storage', parameters('org')[copyIndex()])]",  
        "copy": {  
          "name": "storagecopy",  
          "count": "[length(parameters('org'))]"  

    The copyIndex function allows the template to grab the correct value from the parameter array and the count is set by the length() function so that you don't have to set that manually.

    You can read up on how to make use of the property in different scenarios in the docs:

    The linked template docs also discuss the copy property when it comes to working with nested templates:

    0 comments No comments