How To Password Protect a Static Site in Azure How To Password Protect a Static Site in Azure azure azure

How To Password Protect a Static Site in Azure


On the management portal, you can configure that your site needs to use credentials. Credentials are managed via the Azure portal if you use this method. enter image description here


You could use Forms Authentication which should be pretty straightforward to implement and won't require any startup task (necessary to run appcmd.exe).

Set your application to use forms authentication in your web.config.

<authentication mode="Forms">  <forms name=".ASPXAUTH" loginUrl="/myadminlogin.aspx" protection="All" path="/" timeout="120" /></authentication>

Define the protected folders in your web.config.

 <location path="secure">    <system.web>      <authorization>        <deny users="?" />      </authorization>    </system.web>  </location>

Within your login area check a condition and set the auth cookie:

    'SET AUTH COOKIE    FormsAuthentication.SetAuthCookie(sessionID, False)    response.redirect(/secure/securearea.html)

This unfortunately is the one page where you will need some server side code.