1

I would like to move some value from resources into variables. Hostnames to be specific.

enter image description here However, the syntax from the official documentation doesn't seem to work. https://azure.microsoft.com/en-us/documentation/articles/resource-group-authoring-templates/#variables

      "variables": {
    "sites_site1_hostNames": {
      "hostNames": [
        "host1.com",
        "host2.com",
        "host3.net",
        "host4.azurewebsites.net"
      ]
    },
  },
    "resources": [
      {
        "type": "Microsoft.Web/sites",
        "name": "[variables('sites_site1_name')]",
        "apiVersion": "2015-08-01",
        "location": "West US 2",
       },
        "properties": {
          "name": "[variables('sites_site1_name')]",
          "hostNames": "[variables('sites_site1_hostNames')]",
          "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverfarm1'))]"
        },
        "resources": [],
        "dependsOn": [
          "[resourceId('Microsoft.Web/serverfarms', variables('serverfarm1'))]"
        ]
      }

What would be the proper way to move such values (hostNames) into variables?

Brozaf
  • 136
  • 1
  • 8

1 Answers1

3

Modify variable declaration like so (add "type": "array",):

"sites_site1_hostNames": {
  "type": "array",
  "hostNames": [
    "host1.com",
    "host2.com",
    "host3.net",
    "host4.azurewebsites.net"
  ]
4c74356b41
  • 69,186
  • 6
  • 100
  • 141