0

https://learn.microsoft.com/en-us/azure/application-gateway/tutorial-ssl-powershell

Hi All,

Using above link I'm able to create an application gateway with one Backend pool, with one Http settings, with one listener and with one rule.

But when it comes to Multiple Backend Pool, multiple Http settings, multiple listeners, multiple rules?

How do I define multiple Backend Pools, http settings, listeners and rules while creating Azure application gateway using PowerShell?

1 Answer 1

1

I have tested in my environment.

You can define multiple Backend Pools, http settings, listeners and rules while creating Azure application gateway using PowerShell

For defining multiple front end ports, use below command :

$frontendport1 = New-AzApplicationGatewayFrontendPort -Name FrontendPort1 -Port portnumber
$frontendport2 = New-AzApplicationGatewayFrontendPort -Name FrontendPort2 -Port portnumber

For defining multiple backend pools, use below command :

$backendPool1 = New-AzApplicationGatewayBackendAddressPool -Name AGBackendPool1
$backendPool2 = New-AzApplicationGatewayBackendAddressPool -Name AGBackendPool2

For defining multiple poolsettings, use below command :

$poolSettings1 = New-AzApplicationGatewayBackendHttpSetting -Name myPoolSettings1 -Port portnumber  -Protocol Http -CookieBasedAffinity Enabled -RequestTimeout 30
$poolSettings2 = New-AzApplicationGatewayBackendHttpSetting -Name myPoolSettings2 -Port portnumber  -Protocol Http -CookieBasedAffinity Enabled -RequestTimeout 30

For defining multiple listeners, use below command :

$defaultlistener1 = New-AzApplicationGatewayHttpListener -Name AGListener1 -Protocol Http -FrontendIPConfiguration $fipconfig -FrontendPort $frontendport1
$defaultlistener2 = New-AzApplicationGatewayHttpListener -Name AGListener2 -Protocol Http -FrontendIPConfiguration $fipconfig -FrontendPort $frontendport2

For defining multiple rules, use below command :

$frontendRule1 = New-AzApplicationGatewayRequestRoutingRule -Name rule1 -RuleType Basic -HttpListener $defaultlistener1 -BackendAddressPool $backendPool1 -BackendHttpSettings $poolSettings1
$frontendRule2 = New-AzApplicationGatewayRequestRoutingRule -Name rule2 -RuleType Basic -HttpListener $defaultlistener2 -BackendAddressPool $backendPool2 -BackendHttpSettings $poolSettings2

Now you can define this multiple Backend Pools, http settings, listeners and rules while creating Azure application gateway.

You can use below command to create Azure Application Gateway :

New-AzApplicationGateway -Name AppGatewayName -ResourceGroupName RGName -Location westus2 -BackendAddressPools $backendPool1, $backendPool2 -BackendHttpSettingsCollection $poolSettings1, $poolSettings2 -FrontendIpConfigurations $fipconfig -GatewayIpConfigurations $gipconfig -FrontendPorts $frontendport1, $frontendport2 -HttpListeners $defaultlistener1, $defaultlistener2 -RequestRoutingRules $frontendRule1, $frontendRule2 -Sku $sku

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you let me test it and update you
Glad to know that your issue has resolved. If the answer is helpful, please click "Accept Answer" and upvote it. You can accept it as answer( click on the check mark beside the answer to toggle it from greyed out to filled in and click on Up Arrow). This can be beneficial to other community members. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.