Reset deployment tokens in Azure Static Web Apps
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.
Reset a deployment token
Select Manage deployment token on the Overview page of your Azure Static Web Apps site.
Select Reset token.
After displaying a new token in the Deployment token field, copy the token by selecting Copy to clipboard.
Update a secret in the GitHub repository
To keep automated deployment running, after resetting a token you need to set the new value in the corresponding GitHub repository.
Go to your project's repository on GitHub, and select the Settings tab.
Select Secrets from the menu item. Find a secret generated during Static Web App provisioning named AZURE_STATIC_WEB_APPS_API_TOKEN... in the Repository secrets section.
If you created the Azure Static Web Apps site against multiple branches of this repository, you 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.
Paste the value of the deployment token to the Value field.
Select Update secret.