Search code examples
phpazureadminpassword-protection

How to password protect a website directory on a free default Azure app service plan?


I have a PHP/MySQL website running on an Azure free default app service plan. I have an admin directory on the site and I want to password protect it so that it's not publicly accessible. I normally work on Linux/Apache and this is pretty easy to do with .htaccess or cpanel.

This blog post here:

http://blogs.msdn.com/b/silverlining/archive/2011/11/23/packaging-a-custom-php-installation-for-windows-azure.aspx

seems like the way everyone's recommending to do it, but I'm having trouble following it. One of the main issues is that he assumes I set my app up using scaffolds but instead I created a free default app using the Azure web portal. So my directory structure at the start looks like this:

/site
  /diagnostics
  /wwwroot
  /locks
  /deployments
/LogFiles
  ...

What are the instructions to password protect a directory on my website using this starting point?


Solution

  • You can use Azure easy auth,but the whole site will be password protected: https://azure.microsoft.com/en-us/blog/azure-websites-authentication-authorization/

    You can use forms auth: http://blogs.msdn.com/b/silverlining/archive/2012/01/09/how-to-password-protect-a-php-website-directory-in-azure.aspx

    Or you can use this HttpAuthenticationModule dll: https://github.com/nabehiro/HttpAuthModule#usage-for-php

    You should be able to modify the web.config to restrict the path to be the /admin path.