Search code examples
azureazure-load-balancerazure-vm

Deploying a VM under load balancer gives me an error in Azure


I have one VN and two subnets within it, I am creating a VM which has no public IP on Zone 1. I then created a loadbalance and made a backend pool and put the backend-pool in the same VN as VM.

I now tries to associate backendpool with the VM. As I told my VM is in Zone1. When I tries to associated my VM to backendpool of loadbalancer I get below error

{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\r\n \"error\": {\r\n \"code\": \"ComputeResourceZoneConstraintDoesNotMatchPublicIPAddressZoneConstraint\",\r\n \"message\": \"Compute resource /subscriptions/69c94256-2d95-43fa-8c2e-ac669cdb621d/resourceGroups/thermo-breast-cancer-rg/providers/Microsoft.Compute/virtualMachines/thermo-breast-cancer-devvm1 has a zone constraint 1 but the PublicIPAddress /subscriptions/69c94256-2d95-43fa-8c2e-ac669cdb621d/resourceGroups/thermo-breast-cancer-rg/providers/Microsoft.Network/publicIPAddresses/12.12.25.25 used by the compute resource via NetworkInterface or LoadBalancer has a different zone constraint Regional.\",\r\n \"details\": []\r\n }\r\n}"}]}

I can not figure out where I am doing mistake?


Solution

  • You could create a Standard load balancer instead of Basic SKU with same zone as your backend VM zone.

    enter image description here

    To align and guarantee your frontend and backend with a single zone, only place virtual machines within the same zone into the corresponding backend pool.

    To address virtual machines across multiple zones, place virtual machines from multiple zones into the same backend pool.

    Read Standard Load Balancer and Availability Zones for more details.