An Azure service that provides streamlined full-stack web app development.
The deployment token for an Azure Static Web App can be reset in several supported ways. If the portal action “Resetting token” fails, use one of the programmatic options and then update the token in the repository secret.
- Try resetting the token from the Azure portal again
- In Azure Portal, open the Static Web App.
- On the Overview page, select Manage deployment token.
- Select Reset token.
- When a new token appears in Deployment token, copy it.
- If this still fails with “Resetting token failed”, use CLI or PowerShell as below.
- Reset the deployment token using Azure CLI
- Ensure Azure CLI is installed and logged in.
- Run:
az staticwebapp secrets reset-api-key \ --name <static-site-name> \ --resource-group <resource-group-name> - This command resets the deployment token for the static app. If needed, add
--no-waitor global arguments as per the documentation.
- Reset the deployment token using PowerShell
- Ensure the Az.Websites module is installed and connected to the subscription.
- Run:
Reset-AzStaticWebAppApiKey -ResourceGroupName <resource-group-name> -Name <static-site-name> - This resets the API key (deployment token) for the existing static site.
- If using SDKs (automation scenarios)
- .NET: Use
StaticSiteResource.ResetApiKeyorStaticSiteResource.ResetApiKeyAsyncwith aStaticSiteResetContentinstance to reset the API key via the ARM SDK.
- .NET: Use
- Update the token in the GitHub repository secret
After a successful reset (by portal, CLI, PowerShell, or SDK):
- Go to the GitHub repository used by the Static Web App.
- Open Settings → under Security, select Actions.
- In Repository secrets, locate the secret named
AZURE_STATIC_WEB_APPS_API_TOKEN...that corresponds to this Static Web App. - Select the edit (pen) icon.
- Paste the new deployment token into Value.
- Select Update secret.
If all reset methods (portal, CLI, PowerShell) fail, this indicates a backend issue with the Static Web App resource; in that case, raise a support ticket with the error details and the Static Web App name and resource group.
References: