Azure - 在ARM模板中指定负载均衡器规则

时间:2016-11-22 21:30:36

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

我正在尝试修改我部署了一些虚拟机并定义一些自动调度规则的ARM模板(您可以在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."}]}}

我已经在下面添加了一些相关变量,并且还包含了我的loadbalancer对象,但我认为该问题与我如何引用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
        }
      }
    ]
  }
},

1 个答案:

答案 0 :(得分:0)

请转到门户网站并打开支持请求,看看您的模板编辑有什么问题。