I'm new to Azure, and my team and me are setting a production environment in the Azure cloud, there will be a load balancer with a few instances behind, in the deployment process using Ansible I'd like to remove a instance from the balancer while updating the code, it is posible to do that programmatically using the azure cli or an api, and then add it back to the balancer when the deploy in the instance is done?

It can be done in the web interface but that will not work for the automated deployments.

What i have tried is to force the instance to appear unhealthy to the load balancer, setting the health-check end point to return 500 or something not 200, but I think is not the right way to do it.


Disabling the service should be enough because once the health check fails, the affected VM will be automatically "out" of the LB.

However, you can use PowerShell or CLI to add or remove servers from the backend pool.


Get started creating an Internet facing load balancer in Resource Manager using PowerShell


Get started creating an Internet facing load balancer (classic) in PowerShell

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.