1

I have a public Ip address in Azure that is associated with a load balancer. I am trying to use the Java client to dissociate the LB from the IP.

I have attempted quite a few things but the last attempt was the following:

LoadBalancer lb = myPublicIpAddress.getAssignedLoadBalancerFrontend().parent();
LoadBalancerFrontend frontEnd = myPublicIpAddress.getAssignedLoadBalancerFrontend();
lb.update().updatePublicFrontend(frontEnd.name()).withoutPublicIPAddress().parent().apply()

From this I get the error:

CloudException: Frontend IP Configuration must reference either a Subnet, Public IP Address or Public IP Prefix

myPublicIpAddress is a PublicIpAddress object retrieved directlty from azure. The exception confuses me because the frontend is attatched to a public IP

edit: Also of note, This post here uses Azure commands and goes through the NIC. I've tried to replicate this with the java client but the NIC in my project isn't setup the same and this doesn't work.

To replicate: Create a public IP in Azure. Create a LB in Azure and associate it to the IP. Attempt to dissociate via the method above.

Old Schooled
  • 1,222
  • 11
  • 22

1 Answers1

1

The public IP for Azure Load Balancer is not the same as the public IP for Azure VM. The Load Balancer must be created with at least a public IP. It means you do not delete all public IP from the Load Balancer.

To disassociate the public IP from the Load Balancer, you need to delete the IP configuration in the Load Balancer front end. I think the method withoutFrontend(String name) that you have used is the right way. What you should pay attention to is that if you want to delete the public Ip from the Load Balancer, there should be more than one public Ip associated with the Load Balancer. You must leave one public Ip for the Load Balancer at least.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
  • You rock my socks Charles. It says I shouldn't say 'thanks' or '+1' in this comment, however, I'm really, really thankful so, thankYouVeryMuch! The answer is that IPs can't be deleted from a LB if there is no other IP there. A LB must have an IP. Thank you Charles. – Old Schooled May 03 '19 at 13:40