Skip to main content

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

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(...

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine: threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration: TeamCity .NET 4.51 EF 6.0.2 VS2013 It see...

Navigating Cloud Strategy after Azure Central US Region Outage

 Looking back, July 19, 2024, was challenging for customers using Microsoft Azure or Windows machines. Two major outages affected customers using CrowdStrike Falcon or Microsoft Azure computation resources in the Central US. These two outages affected many people and put many businesses on pause for a few hours or even days. The overlap of these two issues was a nightmare for travellers. In addition to blue screens in the airport terminals, they could not get additional information from the airport website, airline personnel, or the support line because they were affected by the outage in the Central US region or the CrowdStrike outage.   But what happened in reality? A faulty CrowdStrike update affected Windows computers globally, from airports and healthcare to small businesses, affecting over 8.5m computers. Even if the Falson Sensor software defect was identified and a fix deployed shortly after, the recovery took longer. In parallel with CrowdStrike, Microsoft provi...