Removing a VM from the load balancer

Removing a virtual machine from a load balancer requires you to retrieve the configuration of the attached NIC, detach the NIC from the load balancer backend address pool, and then to update the NIC. This process requires three commands.

To retrieve the network interface card configuration, run the Get-AzureRmNetworkInterface command as follows:

$nic = Get-AzureRmNetworkInterface `
-ResourceGroupName "VMLab" `
-Name "myVM4"

The preceding command retrieves the configuration of the NIC for the myVM4 virtual machine and stores it in a variable called $nic.

After retrieving the NIC configuration, alter it so that it's no longer connected to the backend pool by setting the LoadBalancerBackendAddressPools property of the virtual NIC to $null, as follows:

$nic.Ipconfigurations[0].LoadBalancerBackendAddressPools=$null

Finally, update the virtual NIC with the following Set-AzureRmNetworkInterface command:

Set-AzureRmNetworkInterface -NetworkInterface $nic

Performing these steps will disconnect the myVM4 virtual machine from the load balancer. To confirm, close your browser, re-open it, and browse your load balancer's IP address. The only virtual machine that should be servicing your requests is myVM3.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.30.253