azure web app vnet integration and network security group - azure-web-app-service

I have deployed a virtual network to azure and created a subnet and 1 network security group.
vnet 10.0.0.0/16
subnet 10.0.1.0/24
network security group
I associated my network security group to the subnet. Everything went fine so far.
So I created a web app, and added this resource to the subnet previously created.
I wanted to run some test and see if in the network security group I can block my IP from accessing the web app.
so in the inbound rules of the network security group I added 1 rule as follow:
Source = IP address
Source = My IP address/32
Source port ranges = *
Destination = any
Service = Custom
Cestinarion port = *
Protocol = Any
Action Deny
At this point I tried to go to the url of the web app and open it, and I was able to access the url without any issue.
At this point I was quiet confused, so under the blade Networking in the web app I enabled the IP restriction and Deny access to my ip, and here I was able to block access to the web app from my IP.
Can please anyone shade some light on what I am doing wrong here? because I really cannot figure out what I am doing wrong.
And please if my question is not 100% clear, just let me know and I will give more details.

Related

Azure NetworkSecurityGroup rule for WebApp

I want to enable traffic from my webapp (that sits inside the VNET and has its private IP) to Application Gateway (that is deployed to the same VNET and has NSG attached to its subnet).
How can I do it?
If I add webapp outbound ip to NSG as allowed - traffic works fine, but I do not want to hardcode this ip.
If I add "Internet" service tag it works as well, but it is too broad for my taste.
I could not find any other relevant service tags for me (tried "AppServiceManager", "AppService" and "AppService.AustraliaEast").
Also checked this document (and had to update the filename to last Monday! :) ) but could not find the IP that worked for me (52.187.231.76).
Ideal solution would be to allow only VNET traffic, but this did not do the trick as well... All ServiceEndpoints are there.
Checked with Azure support. Unfortunately there is no service tags available to do this yet.
Workaround - to manually add security rules for each application that supposed to access Application Gateway to allow Outbound IPs.
To do so - go to azure portal, to the application that needs to be able to access App GW. Go to properties blade and copy Outbound IP addresses. Then go to NSG and create a new inbound security rule to allow access from all of those IPs (at least it can be 1 rule).
According to Azure support those IPs should not change unless you recreate the whole webapp and the app can only cycle through those IPs.

Allow Web Apps through Network Security Group

We have a few Web Apps that need to access database on VM that behind Network Security Group. How do we allow Web App through Network Security Group?
Web App will use a set of outbound Public IP addresses to reach Internet. You can get those IP address by navigating to the Properties of the Web App.
In your NSG, you can use the Source IP as the list of IP that you got from Properties blade to allow traffic to your database. Also make sure to only open the port used by the database, and nothing else.

Azure Internal ASE with Firewall

I am running a Linux container as a web app in an internal ASE.
The ASE is deployed to a Vnet (secondary Vnet) which is peered to a another Vnet(Primary vnet) where an Azure firewall exists.
1.I have Enable service endpoints to SQL, Storage, and Event Hub on your ASE subnet.
2.From the Azure Firewall UI > Rules > Application rule collection, Set App Service Environment FQDN Tag and the Windows Update Tag.
3.From the Azure Firewall UI > Rules > Network rule collection, Set the ports to 123.Create another rule the same way to port 12000 to help triage any system issues.
4.Create a route table with the management addresses from App Service Environment management addresses with a next hop of Internet, set 0.0.0.0/0 directed to the network appliance ( Firewall internal IP address)
5.Create Application rules to allow HTTP/HTTPS traffic (Note: address is the IP of the ILB of the Internal ASE, since I cant find an IP for the web app itself)
I don't seem to be able to reach the web app. Any guidance will be appreciated. is the problem that I created an Internal ASE?
I am trying to isolate the ISE and control external access to it via a firewall.
MSDocs I referenced :https://learn.microsoft.com/en-us/azure/app-service/environment/firewall-integration
Yes, I think it's the problem with internal ASE. Also, the referring document is intended to lock down all egress from the ASE VNet. Inbound management traffic for an ASE can not be sent through a firewall device.
There are a number of inbound dependencies that an ASE has. The
inbound management traffic cannot be sent through a firewall device.
The source addresses for this traffic are known and are published in
the App Service Environment management addresses document. You can
create Network Security Group rules with that information to secure
inbound traffic.
In addition, since it's an internal ASE, it is deployed in your VNet with ILB. You can not directly access its backend web app over the Internet, you need at least a public-facing Ip address (external VIP )or other public-facing services(Public Azure application gateway) in front of it.
It will like this,

Azure ASE v2 - restrict network access for app services

I have an ILB ASE v2 with WAF (public IP). The ASE has its subnet where all web apps reside. For obvious security reasons I think I need to lock down access from Internet and leave only HTTPS open. But when I do that I can't see app services info in the portal. So what should my NSG look like for this subnet?
Also, WAF has its own subnet. It doesn't have NSG assigned either. Should it have one?
When you add a NSG to the AppSercice subnet with Deny All internet traffic, it is blocking the portal to fetch information from App Device. Try adding a NSG rule with greater priority with source IP as Azure Cloud tag and allow it.
So you are blocking all Internet traffic and allowing Azure IPs for communication.
Let me know if it works.
Here's the resulting rules set for ASE subnet NSG:
you might want to add HTTP to it if you need it.

How can I get the NSG of an app gateway in Azure if the name is not known

I need to get the NSG an app gateway is connected to, I have the url it is listening for, any way I can get to the NSG by using just the name?
I know the app gateway name but cant see where to view the NSG?
Just go to Application gateway dashboard and click the Virtual network/subnet in the right top corner, then you will navigate to the Virtual network page---settings---subnets. You will see the security group name attached to your app gateway subnet.

Resources