1

I have two VMS backendvm0 and backendvm1, I am trying to add these Vms to the backendpool of Azure load balancer from Load balancer ARM template deployment. I am using parameter object as below. It is not giving any error, load balancer is being created with name tlba001backendpool_test but it is not showing any VM attached to it.

 "backendAddressPools": {
  "value": [
    {
      "name": "tlba001backendpool_test",
      "id": "",
      "properties": {
        "loadBalancerBackendAddresses": [
          {
            "name": "backendvm0",
            "properties": {
              "ipAddress": "10.0.2.5"
            }

          },
          {
            "name": "backendvm1",
            "properties": {
              "ipAddress": "10.0.2.4"
            }
          }
        ] 

      }
    }
  ]
},

enter image description here

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
AUGgn
  • 47
  • 8

1 Answers1

2

Because this is being governed by the nic properties, not load balancer, you need to modify the NIC properties and assign the NIC to the load balancer.

{
    "apiVersion": "2015-05-01-preview",
    "type": "Microsoft.Network/networkInterfaces",
    "name": "[concat(parameters('nicNamePrefix'), copyindex())]",
    "location": "[resourceGroup().location]",
    "copy": {
        "name": "nicLoop",
        "count": "[variables('numberOfInstances')]"
    },
    "dependsOn": [
        "[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]",
        "[concat('Microsoft.Network/loadBalancers/', parameters('lbName'))]"
    ],
    "properties": {
        "ipConfigurations": [
            {
                "name": "ipconfig1",
                "properties": {
                    "privateIPAllocationMethod": "Dynamic",
                    "subnet": {
                        "id": "[variables('subnetRef')]"
                    },
                    "loadBalancerBackendAddressPools": [
                        {
                            "id": "[concat(variables('lbID'), '/backendAddressPools/BackendPool1')]"
                        }
                    ]
                }
            }
        ]
    }
}

https://github.com/Azure/azure-quickstart-templates/blob/master/201-2-vms-loadbalancer-lbrules/azuredeploy.json

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • Thanks for the Answer, In this case I have to update the NIC while creating load balancer. The template format says that we can configure the backendpools https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2019-11-01/loadBalancers#BackendAddressPoolPropertiesFormat – AUGgn Jul 14 '20 at 12:32
  • I've told you what you have to do, updating the LB wont link the vm to the LB – 4c74356b41 Jul 14 '20 at 12:42
  • Thanks , I will go with updating NIC. – AUGgn Jul 15 '20 at 04:32