Hi Raja, Vijay
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
Azure Application Gateway does not natively support directly adding a VMSS as a backend target by its resource ID. Instead, you need to associate the IP addresses of the VM instances within the VMSS or, alternatively, use a Public or Internal Load Balancer that fronts the VMSS as the backend target.
Here are the steps to properly configure the Application Gateway backend pool with a VMSS using Azure CLI:
Option 1: Adding a VMSS by IP Address Or FQDN
- Retrieve the IP addresses of the VM instances in the VMSS. This can be done using the Azure CLI or through the Azure portal.
command to list IP addresses:
az vmss nic list \
--resource-group Rohith-RG \
--vmss-name vmss-01 \
--query "[].ipConfigurations[].privateIpAddress" \
--output tsv
2.Add these IP addresses to the Application Gateway backend pool:
az network application-gateway address-pool update \
--resource-group Rohith-RG \
--gateway-name app-gateway-01 \
--name backpoo-end \
--add backendAddresses ipAddress=XX.XX.XX.XX ipAddress=YY.YY.YY.YY
Replace XX.XX.XX.XX and YY.YY.YY.YY with the actual IP addresses of your VM instances.
3.Add the FQDN to the Application Gateway backend pool:
az network application-gateway address-pool update \
--resource-group MyResourceGroup \
--gateway-name MyAppGateway \
--name MyBackendPool \
--add backendAddresses fqdn=myapp.contoso.com
Option 2: Using a Load Balancer with VMSS
- Create an Azure Load Balancer (if not already done) and associate it with your VMSS.
- Add the Load Balancer's IP address as the backend for the Application Gateway:
az network application-gateway address-pool update \
--resource-group Rohith-RG \
--gateway-name app-gateway-01 \
--name backpoo-end \
--add backendAddresses ipAddress=ZZ.ZZ.ZZ.ZZ
Replace ZZ.ZZ.ZZ.ZZ with the Load Balancer’s frontend IP address.
Note:
By providing the IP addresses of the VMSS instances or using a Load Balancer, the Application Gateway can be properly configured to route traffic to the VMSS.
For details, refer to az network application-gateway address-pool | Microsoft Learn
If you have any further queries, do let us know. If the answer is helpful, please click "Accept Answer" and "Upvote it."