Azure ARM Template for Dropdownn type Parameter

2k views Asked by At

I am creating a Azure ARM template to provision VMs based on the environmnet type; so created an array type parameter as below,

  "EnvironmentType": {
"type": "array",
        "defaultValue": [
            "Dev",
            "Test",
            "PreProd",
            "Prod"
        ]

},

But on Azure portal this parameter is rendered as textbox with comma separated values as shown in below screenshot.

enter image description here

How to get this parameter displayed as dropdown?

2

There are 2 answers

0
Tom Sun On BEST ANSWER

How to get this parameter displayed as dropdown?

As bmoore-msft mentioned we could replace the defaultValue with allowedValues and array with string. We also could set the dropdownlist default value from the template. In your case, please have a try to use the following code. More details we could refer to the Customize the template.

"parameters": {
  "EnvironmentType": {
    "type": "string",
    "allowedValues": [
        "Dev",
        "Test",
        "PreProd",
        "Prod"
    ],
    "defaultValue": "Dev",
    "metadata": {
      "description": "The type of replication to use for the EnvironmentType."
    }
  }
0
bmoore-msft On

Replace "defaultValue" with "allowedValues" and "array" with "string".