App Gateway, Unable to create health probe with powershell

MoTaar 20 Reputation points
2023-09-03T11:26:45.3566667+00:00

I'm currently experiencing an issue while attempting to create a health probe using PowerShell. I've already successfully created multiple health probes through the portal.

When I execute the command, I don't receive any error messages. However, upon checking the portal, I cannot find the health probe that I attempted to create using PowerShell. Interestingly, I am able to create a health probe with the same name via the portal.

Any assistance in resolving this issue would be greatly appreciated. Thank you!

I used the command:

$getgw =  Get-AzApplicationGateway -Name Nametest -ResourceGroupName RGtest

# Create the probe object that will check health 
$probeApi = Add-AzApplicationGatewayProbeConfig -ApplicationGateway $getgw -Name $probeNameApi -Protocol Http -Path '/api/test' -Interval 30 -Timeout 120 -UnhealthyThreshold 3 

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
792 questions
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 23,561 Reputation points Microsoft Employee
    2023-09-04T02:30:59.93+00:00

    @MoTaar

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you would like to add a custom probe to your Application gateway.

    The command you have shared,

    • It only creates a custom Probe.
    • But the created probe is neither associated to a Backend HTTP Setting nor the Application Gateway.
    • Instead, you must use the below example.
    # Load the application gateway resource into a PowerShell variable by using Get-AzApplicationGateway.
    $getgw =  Get-AzApplicationGateway -Name appgwtest -ResourceGroupName appgw-rg
    
    # Create the probe object that will check health at http://contoso.com/path/path.htm
    $probe = Add-AzApplicationGatewayProbeConfig -ApplicationGateway $getgw -Name probe01 -Protocol Http -HostName 'contoso.com' -Path '/path/custompath.htm' -Interval 30 -Timeout 120 -UnhealthyThreshold 8
    
    # Set the backend HTTP settings to use the new probe
    $getgw = Set-AzApplicationGatewayBackendHttpSettings -ApplicationGateway $getgw -Name $getgw.BackendHttpSettingsCollection.name -Port 80 -Protocol Http -CookieBasedAffinity Disabled -Probe $probe -RequestTimeout 120
    
    # Save the application gateway with the configuration changes
    Set-AzApplicationGateway -ApplicationGateway $getgw
    

    Refer : https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-create-probe-ps#add-a-probe-to-an-existing-application-gateway

    Cheers,

    Kapil


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful