title | description | services | author | ms.author | ms.service | ms.topic | ms.date |
---|---|---|---|---|---|---|---|
Reset deployment tokens in Azure Static Web Apps |
Reset tokens in an Azure Static Web Apps site |
static-web-apps |
webmaxru |
masalnik |
static-web-apps |
conceptual |
1/31/2021 |
When you create a new Azure Static Web Apps site, Azure generates a token used to identify the application during deployment. During provisioning, this token is stored as a secret in the GitHub repository. This article explains how to use and manage this token.
Normally, you don't need to worry about the deployment token, but the following are some reasons you might need to retrieve or reset the token.
- Token compromise: Reset your token if it is exposed to an outside party.
- Deploying from a separate GitHub repository: If you are manually deploying from a separate GitHub repository, then you need to set the deployment token in the new repository.
- An existing GitHub repository configured with Azure Static Web Apps.
- See Building your first static app if you don't have one.
-
Click on Manage deployment token link on the Overview page of your Azure Static Web Apps site.
:::image type="content" source="./media/deployment-token-management/manage-deployment-token-button.png" alt-text="Managing deployment token":::
-
Click on the Reset token button.
:::image type="content" source="./media/deployment-token-management/manage-deployment-token.png" alt-text="Resetting deployment token":::
-
After displaying a new token in the Deployment token field, copy the token by clicking Copy to clipboard icon.
To keep automated deployment running, after resetting a token you need to set the new value in the corresponding GitHub repository.
-
Navigate to your project's repository on GitHub, and click on the Settings tab.
-
Click on the Secrets menu item. You will find a secret generated during Static Web App provisioning named AZURE_STATIC_WEB_APPS_API_TOKEN... in the Repository secrets section.
:::image type="content" source="./media/deployment-token-management/github-repo-secrets.png" alt-text="Listing repository secrets":::
[!NOTE] If you created the Azure Static Web Apps site against multiple branches of this repository, you will see multiple AZURE_STATIC_WEB_APPS_API_TOKEN... secrets in this list. Select the correct one by matching the file name listed in the Edit workflow field on the Overview tab of the Static Web Apps site.
-
Click on the Update button to open the editor.
-
Paste the value of the deployment token to the Value field.
-
Click Update secret.
:::image type="content" source="./media/deployment-token-management/github-update-secret.png" alt-text="Updating repository secret":::
[!div class="nextstepaction"] Publish from a static site generator