weaveoftheride
weaveoftheride

Reputation: 4395

Azure restrict access to web app by ip range

I have deployed a node js web app on azure and I want to restrict access to it by ip address. I have done a similar thing easily before in AWS with security groups. However, I am at present on the free dev platform and when I got to the ip restrictions setting tab in the Azure portal gui it says I need to upscale the app because ip restriction is not available on the current platform. What I'm build needs very minimal resources. It is a one page internal static newsletter. What is the minimal resource on azure I need to use to get the ip restriction or is there another route I can use?

Upvotes: 1

Views: 708

Answers (1)

Martin Brandl
Martin Brandl

Reputation: 58931

The minimal resource you need to configure IP restrictions within the Portal is B1:

enter image description here

Read here how to configure it: Azure App Service Static IP Restrictions


Note: You can also enable IP Restrictions on the free tier by adding a web.config using the IP Security setting. Working sample:

<configuration>
  <system.webServer>
    <security> 
        <ipSecurity allowUnlisted="false"> 
            <clear/> 
             <add ipAddress="83.116.19.53" allowed="true"/> 
        </ipSecurity>  
    </security>
</system.webServer> 
</configuration>

Now all you have to do is to put the web.config to your wwwroot directory. You can either include the web.config in your deployment or you manually add it using the Kudu engine.

Just replace <YOURSITE> with your actual site and follow the link:

https://<YOURSITE>.scm.azurewebsites.net/DebugConsole/?shell=powershell

enter image description here

If you now browse the app using an unlisted IP you will get the following error:

You do not have permission to view this directory or page.

Upvotes: 3

Related Questions