To allow the new load balancer to monitor the status of an application or server, we first need to create a health probe. A health probe dynamically adds or removes virtual machines from a load balancer's rotation based on their response to health checks.
By default, a virtual machine is removed from load balancer distribution after two consecutive failures at 15-second intervals. A health probe is typically based on a protocol or a specific health check page for your application in the case of load balancing IIS or web resources.
In the following exercise, we will create a TCP probe that checks for port 80 availability on the virtual machines in the backend pool of the load balancer.
The Add-AzureRmLoadBalancerProbeConfig command is used to create a TCP health probe. Create a port-80 TCP health probe for myLoadBalancer by running the following command:
Add-AzureRmLoadBalancerProbeConfig `
-Name "myHealthProbe" `
-LoadBalancer $lb `
-Protocol tcp `
-Port 80 `
-IntervalInSeconds 15 `
-ProbeCount 2
After creating the health probe, run the following command to apply the probe to the load balancer and to update it:
Set-AzureRmLoadBalancer -LoadBalancer $lb
Running the preceding command should provide feedback like that in the following screenshot:
After setting the load balancer's configuration, you should receive feedback that it was successful.