Hello @sindhu sneha ,
Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.
I understand that you would like to know the best approach to restrict direct access to Azure app service backend while permitting frontend and API requests through Application Gateway with WAF.
To restrict direct access to your backend app service, you can refer the below recommended options:
- Configure Access restriction rules based on service endpoints. This allows you to lock down inbound access to the app making sure the source address is from Application Gateway. Refer: https://video2.skills-academy.com/en-us/azure/app-service/app-service-ip-restrictions?tabs=azurecli#set-a-service-endpoint-based-rule
- Use Azure App Service static IP restrictions. For example, you can restrict the web app so that it only receives traffic from the application gateway. Use the app service IP restriction feature to list the application gateway Public IP as the only address with access. Refer: https://video2.skills-academy.com/en-us/azure/app-service/app-service-ip-restrictions?tabs=azurecli#add-an-access-restriction-rule
You can configure other access restrictions or whitelist other IPs or service tags depending upon your exact requirement.
Kindly let us know if the above helps or you need further assistance on this issue.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.