Hi Raja, Vijay,
Apologies on the misunderstanding,
I understand that you're looking to add a VMSS to the backend pool of the Application Gateway
There are two methods, depending on which orchestration mode you are using for your VMSS
When adding Uniform Virtual Machine Scale Sets to an Application Gateway's backend pool, the process will vary. Use the following command
appGWName=<appGwName>
appGWResourceGroup=<appGWRGName>
backendPoolName=<backendPoolName>
backendPoolId=$(az network application-gateway address-pool show --gateway-name $appGWName -g $appGWResourceGroup -n $backendPoolName --query id -otsv)
vmssName=<vmssName>
vmssResourceGroup=<vmssRGName>
# add app gw backend pool to first nic's first ip config
az vmss update -n $vmssName -g $vmssResourceGroup --add "virtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0].ipConfigurations[0].applicationGatewayBackendAddressPools" "id=$backendPoolId"
# update instances
az vmss update-instances --instance-ids * --name $vmssName --resource-group $vmssResourceGroup
For additional reference, please visit this link: Networking for Azure Virtual Machine Scale Sets - Azure Virtual Machine Scale Sets | Microsoft Learn
When adding Flexible Orchestration VMSS to an Application Gateway, the process differs from adding Uniform VMSS.
When adding a Flexible Scale Set to an Application Gateway, the procedure is similar to adding standalone VMs to the backend pool. You need to update the network interface IP configuration of the virtual machines to include them in the backend pool. This can be achieved either by adjusting the Application Gateway's configuration or by modifying the network interface settings of the virtual machines.
Thanks,
Rohith
If you have questions about this, please let us know in the comments. We are glad to help you.
If the information is helpful, please click on "Upvote" and "Accept Answer" so that it would be helpful to other community members.