Whitelisted IP address for Azure WebApp?

I would like to restrict access to some of the web applications I am developing on Azure using a whitelist of allowed associated IP addresses. I achieved this with the Network Security Group applied to a virtual machine. I also see how I can achieve this using the App Service environment, but it is very expensive. Is there a way to apply a network security group to a web application? Or can I add a network security group to the virtual network? Or is there another method that I skip?

Thanks!

+5
source share
1 answer

You can restrict the IP addresses in the web.config file using the ipSecurity element as follows:

<system.webServer> <security> <ipSecurity allowUnlisted="false"> <add ipAddress="XXX.XXX.XXX.XXX" allowed="true" /> </ipSecurity> </security> </system.webServer> 

Full documentation on the ipSecurity element: https://www.iis.net/configreference/system.webserver/security/ipsecurity

Azure Web App support for this feature: https://azure.microsoft.com/en-us/blog/ip-and-domain-restrictions-for-windows-azure-web-sites/

+5
source

All Articles