Azure ARM 模板将复杂的值转化为变量

Azure RM Template put complex value into variables

我想将一些值从资源转移到变量中。具体的主机名。

但是,官方文档中的语法似乎不起作用。 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'))]"
        ]
      }

将这些值(主机名)移动到变量中的正确方法是什么?

像这样修改变量声明(添加"type": "array",):

"sites_site1_hostNames": {
  "type": "array",
  "hostNames": [
    "host1.com",
    "host2.com",
    "host3.net",
    "host4.azurewebsites.net"
  ]