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.


Reset a deployment token

  1. Select Manage deployment token on the Overview page of your Azure Static Web Apps site.

    Managing deployment token

  2. Select Reset token.

    Resetting deployment token

  3. 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.

  1. Go to your project's repository on GitHub, and select the Settings tab.

  2. 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.

    Listing repository secrets


    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.

  3. Select Update.

  4. Paste the value of the deployment token to the Value field.

  5. Select Update secret.

    Updating repository secret

Next steps