Isolate Web Application from public internet (App Service)

In this post, we will talk about web endpoint security. Let us start from a basic requirement and see what we need to fulfil it.
The web application hosted inside App Services shall not be public available from internet.

Context
The requirement is simple and clear, but can give us headaches if the team does not cover it from the beginning. Microsoft Azure is offering two options to fulfil it:

  • IP Restrictions
  • App Service integration with VNET
  • VNET with dedicated App Service Environment


IP Restrictions
App services is allowing us to specify a list of IPs that can access our web application. The feature is similar with the IP restriction functionality offered by IIS and can be configured inside web.config.
The difference between this two is the location where these checked is done. Using IP Restrictions the check is done a layer before the IIS. Additional this, the configuration can be done from Azure Portal or using ARM templates. There is no need to modify the configuration file of your application, meaning that all security setups can be done from only one place.
Do not forget that inside the IP Restriction list you can define only whitelist IPs. This means that once you add your first IP in the list, all requests that are coming from different IPs will not be allowed. You have the ability to define a whitelist and not a blacklist. Even if this might sounds strange, in this way you have the ability to know exactly who has access to your system.

This approach does not fulfil 100% our requirements. The web endpoint can still be accessible from internet, but with limited access. Meaning that any IP from internet can try to access our endpoint, but the IP Restriction layer will drop connections from IPs that are not in our whitelist.

VNET combined with ILB
This solution involves restricting public access to our web application by adding it inside a VNET. Once our App Service is inside the VNET we can disable the public load balancer and create an Internal Load Balancer for our App Services.
Without a public load, balancer traffic from public internet cannot reach our web application anymore. We do not have a public IP and a domain name.
Microsoft Azure allows us to connect to a VNET from our own subscription or from another subscription. This part can be done from Azure Portal also, not only from ARM or from PowerShell.
Once we have this connection establish, Azure is creating automatically a Point-to-Site VPN connection between our VNET and our App Service. This connection limits the access to our App Services VMs that are behind it. In this moment your web application can be accessed directly from your VNET.

STOP: In this moment even if you have a connection between your your App Service and VNET, your web application is still accessible from internet. You just have a direct connection to access the resources from VNET directly from App Services, without going outside your network.
This kind of solution does not fulfills your requirements because the web application is still accessible from the internet using DNS or Public IP.

Dedicated App Service Environment
This solution is offering us a dedicated App Service Environment inside our VNET where we have full control, including who can access it. From the beginning expect higher running price, in comparison with a normal App Service instance, but you can manage it completely.
When you create an App Service Environment, you can configure in a such a way to not have a public IP (internet facing endpoint) and only an ILB (Internal Load Balancer) that has a private IP (a VNET IP). This will allow incoming traffic only from your VNET or other networks that are connected using a VNET connection to it.
There are some things that you need to know and have before creating an App Service Environment like domain name, app certificates and DNS management endpoint. This are required from the beginning because all this things are managed internally, inside the VNET.
Using this approach you'll have an environment when you can run your own web application completely isolated from the internet. Access will be done only through the VNET.

Conclusion
Depending on your current needs and what you want to achieve you can use any of this approach. A fast solution can be based on IP Restrictions. For more complex scenarios, where on-premises systems are involved, an integration with VNET might be much better.

Comments