Deny list and Allow list for Azure Web App - azure

I have an Azure Web app running behind the Azure Application gateway which is configured in WAF mode. I have allowed only Azure Gateway IP and our own public/proxy IP to connect Azure Wab App which means all traffic is being routed to Web is being through Application Gateway only.
Now, I want to DENY access to specific list of IPs to my Azure Web App. I am not sure how and where can i configure this DENY list ? Thanks in advance!

Now, I want to DENY access to specific list of IPs to my Azure Web
App.
Based on my knowledge, maybe you can use IP Restrictions to allow some IP to access your app.
More information about IP Restrictions, please refer to this article.
Update:
Thanks for Saurabh Singh share, customer can edit web.config to add IP list:
<security>
<ipSecurity allowUnlisted="true">
<add ipAddress="111.223.118.66" allowed="false"/>
</ipSecurity>

Related

Is it necessary to add Azure IP datacenter IP's to app service whitelist?

I have to restrict public access to my Azure app service, Hence I have implemented IP whitelist in web config. Is it required to whitelist the Azure datacenter IP ranges?
My app service uses Azure SQL, redis and search service.
Short answer to your question is no, you will not need to add Azure data center IP addresses for using Azure services. Only case where you need to add IP addresses to the allow list is when a service/application tries to access your web application and not the other way round.
Given your objective to restrict public access, you should definitely consider using the IP restrictions feature from Azure Portal. Microsoft has improved this feature and it's better than having just the web.config <ipsecurity> configuration,
With Azure App Service IP restrictions, traffic will blocked even
before it reaches your IIS.
You can still continue to use your web.config configuration as it is.
Configuration effort is pretty minimal as it's all available through portal
Read more about it here
Azure App Service Static IP Restrictions
For a time, the IP Restrictions capability in the portal was a layer
on top of the ipSecurity capability in IIS. The current IP
Restrictions capability is different. You can still configure
ipSecurity within your application web.config but the front-end based
IP Restrictions rules will be applied before any traffic reaches IIS.

How to associate a nsg to app service environment to restrict access from internet in Azure

I wanted to restrict access from internet to my app service environment, such that only my front end app service can only access it. Is there a possible way to do it?.
As shown in the above picture I wanted to associate an NSG to tier 2 such that only tier 1 can access tier 2. Nobody else can access it. Is there a solution to this problem?
Developers can use IP and Domain Restrictions to control the set of IP addresses, and address ranges, that are either allowed or denied access to their websites. With Windows Azure Web Sites developers can enable/disable the feature, as well as customize its behavior, using web.config files located in their website
<system.webServer>
<security>
<ipSecurity>
<add ipAddress="x.x.x.x" allowed="false" />
</ipSecurity>
</security>
</system.webServer>
https://azure.microsoft.com/en-us/blog/confirming-dynamic-ip-address-restrictions-in-windows-azure-web-sites/
If a request is made to a website from an address outside of the allowed IP address range, then an HTTP 404 not found error is returned as defined in the denyAction attribute.
https://learn.microsoft.com/en-us/azure/app-service/environment/network-info
https://learn.microsoft.com/en-us/azure/app-service/environment/forced-tunnel-support

how to deploy a azure api app to private network

I would like to use some of the benefits of hosting a web api in Azure, but I want that api to be private (not accessible from the outsite world) as it only be used internally.
I am not sure if that is even possible. I've tried deploying from visual studio but the api is hosted on xyz.azurewebsites.net and is accessible from everywhere.
Thanks in advance.
You could restrict access to the site to a specific ip address or range of addresses through the web.config. Add a section to system.webServer:
<system.webServer>
<security>
<ipSecurity allowUnlisted="false" denyAction="NotFound">
<add allowed="true" ipAddress="123.456.0.0" subnetMask="255.255.0.0"/>
</ipSecurity>
</security>
</system.webServer>
More info here: IP and Domain Restrictions for Windows Azure Web Sites
In addition to levelnis's suggestion about static ip security restricting access, there is the option of using an App Service Environment.
https://learn.microsoft.com/en-us/azure/app-service-web/app-service-app-service-environment-intro
App Service Environments are ideal for application workloads
requiring:
Very high scale
Isolation and secure network access
An ASE is always placed in a virtual network's subnet, so you can use NSGs to control access. ASEs are a Premium service though so can be quite expensive.

restrict azure appservice / website to a domain

I have a WCF service running on a azure app service. I want to restrict this WCF to a few azure website, external IPs and some other deployments.
I am using IPSecurity tag for that in my WCF web.config
My issue is the IP restrictions work, but the azure website domains that i allow access to, dont seem to work.
for exmaple, i have an azure website with a custom domain, abcdef.info. i am trying to give this domain access to wcf, but it doesnt seem to be working.
below is my configuration.
<ipSecurity enableReverseDns="true" allowUnlisted="false">
<add ipAddress="127.0.0.1" allowed="true" />
<add ipAddress="xx.xx.xx.xx" allowed="true" /> (IP of azure website i got after nslookup)
<add domainName="azurewebsitedomain.azurewebsites.net" allowed="true" />
<add domainName="abcdef.info" allowed="true" /> (custom domain tied to my azure website)
</ipSecurity>
i was assuming that one of the last 3 settings here will whitelist my wcf client running to azure website to access WCF but so far nothing.
Will appreciate any help. Thanks.
Azure Web App infrastructure uses different IP's for inbound and outbound communications. You have whitelisted the inbound IP address. Also, Whitelisting the domain name may not work either.
Azure Web Apps use a set of 4 outbound IP's for Outbound communication. This can be retrieved from portal:
Select the web app
Click on Properties
Copy the OUTBOUND IP ADDRESSES
Whitelist these 4 IP Addresses the way you did earlier and then you could test by issuing a CURL request from the KUDU console (SCM) of the source app.
curl -i https://destinationsitename.azurewebsites.net

Cannot connect to Azure Cloud Service from my Azure Website with Virtual IP?

I have a Azure Website with virtual IP (ip based SSL), however, in my cloudservice I have to specify the address of my website to whitelist. Somehow I think I'm missing the obvious here since I cannot connect to my webservice when I deny all BUT my website. If I remove the Deny All -rule I can connect fine.
I now have, which wont work:
<AccessControl name="accessRestriction">
<Rule action="permit" description="permit-site" order="1" remoteSubnet="VIRTUALIPADDRESS/32" />
<Rule action="deny" description="deny-public" order="2" remoteSubnet="0.0.0.0/0" />
</AccessControl>
</AccessControls>
EDIT:
my website cannot connect to the webservice.(Unable to connect to the remote server)
EDIT2:
In my intellitrace log I can see that indeed the website is trying to gain access but is blocked
'Requested registry access is not allowed.'
Side note: If I add a permit-rule for my local home IP I CAN reach the webservice if my run my website locally (and connect from home).
2nd, off-topic question, In a lot of tutorials I see people using 'Order=100' and, 200 and then 300, instead of just using 1,2,3, why 3 digits? (answered)
EDIT3: both website and service are now https, still no connection possible with ACL enabled.
Thanks!
IP SSL does not guarantee the outbound IP address for outgoing connections, but it only associates the inbound IP with your site. You will need to whitelist all possible outbound IP addresses for your site according to what region your site is in.
For the list of outbound possible IP addresses you can look at https://social.msdn.microsoft.com/Forums/azure/en-US/fd53afb7-14b8-41ca-bfcb-305bdeea413e/maintenance-notice-upcoming-changes-to-increase-capacity-for-outbound-network-calls?forum=windowsazurewebsitespreview
The reason for this is that Azure Websites is a multitenant environment and the outbound IP address cannot be guaranteed at the site level.

Resources