Search code examples
azurepowershellazure-rm

How does New-AzureRmLoadBalancerProbeConfig know which Load Balancer to create the probe against


I'm trying to create a new health probe via PowerShell and AzureRM 6.13.1

The command taken directly from the azure-docs looks as follows;

New-AzureRmLoadBalancerProbeConfig -Name "MyProbe" -Protocol "http" -Port 80 -IntervalInSeconds 15 -ProbeCount 15

I have several load balancers in various resource groups yet the above cmdlet takes no resource group or load balancer name... how can it ever hope to create the probe against the correct Load balancer.

needless to say the above cmdlet does nothing.


Solution

  • It is true that this cmdlet doesn't take a Load Balancer name. Nevertheless, it does create a probe configuration as shown below:

    New-AzureRmLoadBalancerProbeConfig

    This can be passed on to Add-AzureRmLoadBalancerProbeConfig later on, as follows, which takes the Load Balancer name as an input:

    Get-AzureRmLoadBalancer -Name "myLB" -ResourceGroupName "myRG" | Add-AzureRmLoadBalancerProbeConfig -Name "probe-test" -RequestPath healthcheck2.aspx -Protocol http -Port 81 -IntervalInSeconds 16 -ProbeCount 3 | Set-AzureRmLoadBalancer
    

    The same has been detailed in the quickstart docs as well.

    Hope this clarifies!