Muokkaa

Jaa


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.

Prerequisites

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.

  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. Under the Security section, select Actions.

  3. Find a secret generated during Static Web App provisioning named AZURE_STATIC_WEB_APPS_API_TOKEN... in the Repository secrets section.

    Note

    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.

  4. Select pen icon button to update the value.

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

  6. Select Update secret.

Next steps