|
| 1 | +--- |
| 2 | +title: Enable password protection for Azure Static Web Apps |
| 3 | +description: Prevent unauthorized access to your static web app with a password. |
| 4 | +services: static-web-apps |
| 5 | +author: craigshoemaker |
| 6 | +ms.service: static-web-apps |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 03/13/2022 |
| 9 | +ms.author: cshoe |
| 10 | +--- |
| 11 | + |
| 12 | +# Configure password protection |
| 13 | + |
| 14 | +You can use a password to protect your app's pre-production environments or all environments. Scenarios when password protection is useful include: |
| 15 | + |
| 16 | +- Limiting access to your static web app to people who have the password |
| 17 | +- Protecting your static web app's staging environments |
| 18 | + |
| 19 | +Password protection is a lightweight feature that offers a limited level of security. To secure your app using an identity provider, use the integrated [Static Web Apps authentication](authentication-authorization.md). You can also restrict access to your app using [IP restrictions](configuration.md#networking) or a [private endpoint](private-endpoint.md). |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +An existing static web app in the Standard plan. |
| 24 | + |
| 25 | +## Enable password protection |
| 26 | + |
| 27 | +1. Open your static web app in the Azure portal. |
| 28 | + |
| 29 | +1. Under *Settings* menu, select **Configuration**. |
| 30 | + |
| 31 | +1. Select the **General settings** tab. |
| 32 | + |
| 33 | +1. In the *Password protection* section, select **Protect staging environments only** to protect only your app's pre-production environments or select **Protect both production and staging environments** to protect all environments. |
| 34 | + |
| 35 | + :::image type="content" source="media/password-protection/portal-enable.png" alt-text="Screenshot of enabling password protection"::: |
| 36 | + |
| 37 | +1. Enter a password in **Visitor password**. Passwords must be at least eight characters long and contain a capital letter, a lowercase letter, a number, and a symbol. |
| 38 | + |
| 39 | +1. Enter the same password in **Confirm visitor password**. |
| 40 | + |
| 41 | +1. Select the **Save** button. |
| 42 | + |
| 43 | +When visitors first navigate to a protected environment, they're prompted to enter the password before they can view the site. |
| 44 | + |
| 45 | +:::image type="content" source="media/password-protection/password-prompt.png" alt-text="Password prompt"::: |
| 46 | + |
| 47 | +## Next steps |
| 48 | + |
| 49 | +> [!div class="nextstepaction"] |
| 50 | +> [Authentication and authorization](./authentication-authorization.md) |
0 commit comments