DnsNameLabelNotSupported - Azure 容器实例的 VSTS ARM 模板

DnsNameLabelNotSupported - VSTS ARM Template for Azure Container Instances

基本上在为 azure 容器实例的 arm 模板添加 "dnsNameLabel" 值后,我收到了这条消息:

2018-07-03T14:31:14.8518944Z ##[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
2018-07-03T14:31:14.8571875Z ##[error]Details:
2018-07-03T14:31:14.8616789Z ##[error]BadRequest: {
  "error": {
    "code": "DnsNameLabelNotSupported",
    "message": "DNS name label for container group is not supported before version '2018-02-01-preview'."
  }
}

摘自手臂-template.json

...
            "osType": "[variables('osType')]",
            "ipAddress": {
                "type": "Public",
                "dnsNameLabel": "rabbitmq",
                "ports": [
                    {
                        "protocol": "tcp",
                        "port": "15672"
                    }
                ]
            },
...

P.S。我正在使用 VSTS 的 Azure 资源组部署任务进行部署。

问题是由arm模板文件中的"apiVersion"键引起的。它必须更新以匹配更新版本的 api。导航至 github arm templates repo 你可以看到哪个是最新版本。

更新到最新版本解决了问题。

另一个建议是使用 JSON 模式验证器来确保 .json 文件的内容与模式匹配。