Skip to content

Files

Latest commit

a43d987 · Apr 22, 2021

History

History
60 lines (38 loc) · 2.99 KB

deployment-token-management.md

File metadata and controls

60 lines (38 loc) · 2.99 KB
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

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. 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":::

  2. Click on the Reset token button.

    :::image type="content" source="./media/deployment-token-management/manage-deployment-token.png" alt-text="Resetting deployment token":::

  3. After displaying a new token in the Deployment token field, copy the token by clicking Copy to clipboard icon.

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. Navigate to your project's repository on GitHub, and click on the Settings tab.

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

  3. Click on the Update button to open the editor.

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

  5. Click Update secret.

    :::image type="content" source="./media/deployment-token-management/github-update-secret.png" alt-text="Updating repository secret":::

Next steps

[!div class="nextstepaction"] Publish from a static site generator