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

How to check in AngularJS if a service was register or not

There are cases when you need to check in a service or a controller was register in AngularJS.
For example a valid use case is when you have the same implementation running on multiple application. In this case, you may want to intercept the HTTP provider and add a custom step there. This step don’t needs to run on all the application, only in the one where the service exist and register.
A solution for this case would be to have a flag in the configuration that specify this. In the core you would have an IF that would check the value of this flag.
Another solution is to check if a specific service was register in AngularJS or not. If the service was register that you would execute your own logic.
To check if a service was register or not in AngularJS container you need to call the ‘has’ method of ‘inhector’. It will return TRUE if the service was register.
if ($injector.has('httpInterceptorService')) { $httpProvider.interceptors.push('httpInterceptorService&#…

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.51EF 6.0.2VS2013
It seems that there …

Run native .NET application in Docker (.NET Framework 4.6.2)

Scope
The main scope of this post is to see how we can run a legacy application written in .NET Framework in Docker.

Context
First of all, let’s define what is a legacy application in our context. By a legacy application we understand an application that runs .NET Framework 3.5 or higher in a production environment where we don’t have any more the people or documentation that would help us to understand what is happening behind the scene.
In this scenarios, you might want to migrate the current solution from a standard environment to Docker. There are many advantages for such a migration, like:

Continuous DeploymentTestingIsolationSecurity at container levelVersioning ControlEnvironment Standardization
Until now, we didn’t had the possibility to run a .NET application in Docker. With .NET Core, there was support for .NET Core in Docker, but migration from a full .NET framework to .NET Core can be costly and even impossible. Not only because of lack of features, but also because once you…