As a follow-up on the presentation I did at CloudBrew about Azure Static Web Apps I want to write a series of blog posts.
- Part I - Using the VS Code Extension
- Part II - Using the Astro Static Site Generator
- Part III – Deploying to multiple environments
- Part IV(this post) – Password protect your environments
Yesterday I showed you how you can have multiple environments for your Azure Static Web App. However not every environment is production-ready or should be accessible to everyone. To limit access you can password protect your staging or all environments.
To enable this feature, you need to open the Azure Poral and go to your static web app resource.
- Go to Settings –> Configuration.
- Switch to the General Settings tab.
- Change the Password protection setting from Disabled to Protect staging environments only to protect only your app's pre-production environments or Protect both production and staging environments to protect all environments.
- Choose a strong Visitor password and enter it again for confirmation.
- Click Save at the top to apply the changes.
If we now try to access our (staging) environment, we first need to enter our visitor password before we can view the site:
More information
Enable password protection for Azure Static Web Apps | Microsoft Learn