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(

Azure AD and AWS Cognito side-by-side

In the last few weeks, I was involved in multiple opportunities on Microsoft Azure and Amazon, where we had to analyse AWS Cognito, Azure AD and other solutions that are available on the market. I decided to consolidate in one post all features and differences that I identified for both of them that we should need to take into account. Take into account that Azure AD is an identity and access management services well integrated with Microsoft stack. In comparison, AWS Cognito is just a user sign-up, sign-in and access control and nothing more. The focus is not on the main features, is more on small things that can make a difference when you want to decide where we want to store and manage our users.  This information might be useful in the future when we need to decide where we want to keep and manage our users.  Feature Azure AD (B2C, B2C) AWS Cognito Access token lifetime Default 1h – the value is configurable 1h – cannot be modified

What to do when you hit the throughput limits of Azure Storage (Blobs)

In this post we will talk about how we can detect when we hit a throughput limit of Azure Storage and what we can do in that moment. Context If we take a look on Scalability Targets of Azure Storage ( https://azure.microsoft.com/en-us/documentation/articles/storage-scalability-targets/ ) we will observe that the limits are prety high. But, based on our business logic we can end up at this limits. If you create a system that is hitted by a high number of device, you can hit easily the total number of requests rate that can be done on a Storage Account. This limits on Azure is 20.000 IOPS (entities or messages per second) where (and this is very important) the size of the request is 1KB. Normally, if you make a load tests where 20.000 clients will hit different blobs storages from the same Azure Storage Account, this limits can be reached. How we can detect this problem? From client, we can detect that this limits was reached based on the HTTP error code that is returned by HTTP