【问题标题】:Azure - Specifying Load Balancer Rules in ARM TemplateAzure - 在 ARM 模板中指定负载均衡器规则
【发布时间】:2016-11-22 21:30:36
【问题描述】:

我正在尝试修改我拥有的 ARM 模板,该模板部署了一些 VM 并定义了一些自动缩放规则(您可以在 https://gist.github.com/jinky32/d80e0ab2137236ff262484193f93c946 看到完整的模板,它基于 https://github.com/gbowerman/azure-myriad/tree/master/vmss-ubuntu-scale 的模板)。

我正在尝试添加一些负载均衡器规则,以便流量分布在新 VM 之间,因为它们是根据定义的自动缩放规则生成的。

当我通过 Azure CLI 运行此模板时,我在终端中没有收到任何错误,但部署失败。挖掘错误事件我看到了两个:

statusCode:BadRequest serviceRequestId:ef42ec66-600e-4fb9-b4e2-dc2c06dda79c statusMessage:{"error":{"code":"InvalidRequestFormat","message":"Cannot parse the request.","details":[{"code":"InvalidJsonReferenceFormat","message":"Reference Id cc2bepool is not formatted correctly. The Id is expected to reference resources of type loadBalancers/backendAddressPools. Path properties.loadBalancingRules[0].properties.backendAddressPool."}]}} responseBody:{"error":{"code":"InvalidRequestFormat","message":"Cannot parse the request.","details":[{"code":"InvalidJsonReferenceFormat","message":"Reference Id cc2bepool is not formatted correctly. The Id is expected to reference resources of type loadBalancers/backendAddressPools. Path properties.loadBalancingRules[0].properties.backendAddressPool."}]}}

statusCode:BadRequest statusMessage:{"error":{"code":"InvalidRequestFormat","message":"Cannot parse the request.","details":[{"code":"InvalidJsonReferenceFormat","message":"Reference Id cc2bepool is not formatted correctly. The Id is expected to reference resources of type loadBalancers/backendAddressPools. Path properties.loadBalancingRules[0].properties.backendAddressPool."}]}}

我在下面放了一些相关变量,还包括了我的负载均衡器对象,但我认为问题与我引用 backendAddressPool 的方式有关:

"loadBalancingRules": [
      {
        "name": "LBRule",
        "properties": {
          "frontendIPConfiguration": {
            "id": "[variables('frontEndIPConfigID')]"
          },
          "backendAddressPool": {
            "id": "[variables('bePoolName')]" 
          },

但我很困惑,因为我在其他地方引用它的方式相同。非常感谢任何有关如何正确执行此操作的建议。

"variables": {
....
"loadBalancerName": "[concat(parameters('vmssName'), 'lb')]",
"lbProbeID": "[concat(variables('lbID'),'/probes/tcpProbe')]",
"publicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]",
"lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('loadBalancerName'))]",
"natPoolName": "[concat(parameters('vmssName'), 'natpool')]",
"bePoolName": "[concat(parameters('vmssName'), 'bepool')]",
....
....
}
.....
.....
{
  "type": "Microsoft.Network/loadBalancers",
  "name": "[variables('loadBalancerName')]",
  "location": "[variables('location')]",
  "apiVersion": "[variables('networkApiVersion')]",
  "dependsOn": [
    "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
  ],
  "properties": {
    "frontendIPConfigurations": [
      ....
    ],
    "backendAddressPools": [
      {
        "name": "[variables('bePoolName')]"
      }
    ],
    "inboundNatPools": [
      {
        "name": "[variables('natPoolName')]",
        ...
      },
       {
        "name": "natpooltileserver",
        ....
      },
      {
        "name": "natpool2",
        ....
    ],
            "loadBalancingRules": [
      {
        "name": "LBRule",
        "properties": {
          "frontendIPConfiguration": {
            "id": "[variables('frontEndIPConfigID')]"
          },
          "backendAddressPool": {
            "id": "[variables('bePoolName')]" 
          },
          "protocol": "tcp",
          "frontendPort": 80,
          "backendPort": 80,
          "enableFloatingIP": false,
          "idleTimeoutInMinutes": 5,
          "probe": {
            "id": "[variables('lbProbeID')]"
          }
        }
      }
    ],
    "probes": [
      {
        "name": "tcpProbe",
        "properties": {
          "protocol": "tcp",
          "port": 80,
          "intervalInSeconds": 5,
          "numberOfProbes": 2
        }
      }
    ]
  }
},

【问题讨论】:

    标签: azure load-balancing azure-resource-manager


    【解决方案1】:

    请访问门户并打开支持请求以查看您的模板编辑有什么问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多