Static Web Apps: deploymentAuthPolicy stuck on "GitHub" (OIDC), can't switch back to DeploymentToken — GitHub Actions deploy fails with "api key was invalid"

ZenixHub Labs 5 Reputation points
2026-08-13T06:34:47.9+00:00

I have a Static Web App (Free tier) connected to a GitHub repo, deploying via the classic

Azure/static-web-apps-deploy@v1 action with azure_static_web_apps_api_token set from a

GitHub secret. Every deployment now fails at the "Build And Deploy" step with:

The content server has rejected the request with: BadRequest

Reason: No matching Static Web App was found or the api key was invalid.

What I've already tried:

  • Reset the deployment token from the Portal ("Manage deployment token" > Reset) and updated the GitHub secret — same error.
  • Reset it again via az staticwebapp secrets reset-api-key, confirmed the new key was correctly fetched and pushed to the GitHub secret — same error persists regardless of how fresh the token is.

Root cause found via:

az rest --method get --url "https://management.azure.com/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Web/staticSites/<name>?api-version=2023-01-01"

"properties.deploymentAuthPolicy" is set to "GitHub" (OIDC-based), not "DeploymentToken".

This explains why every static token is rejected outright — the resource stopped accepting

token-based auth entirely.

I tried to PATCH it back:

az rest --method patch --url ".../staticSites/<name>?api-version=2023-01-01" \

--body '{"properties":{"deploymentAuthPolicy":"DeploymentToken","repositoryToken":"<PAT with repo+workflow scope>"}}'

This still returns:

"DeploymentAuthPolicy is invalid. Cannot update policy without providing repository token."

Questions:

  1. What's the supported way to switch an existing Static Web App from GitHub-OIDC deploymentAuthPolicy back to classic DeploymentToken auth?
  2. Is there a specific PAT scope/format expected for repositoryToken that differs from a standard classic PAT with repo + workflow scopes?
  3. The Azure Portal doesn't show any toggle for this on the Overview / "Manage deployment token" page for this resource — is that setting exposed anywhere in the Portal UI, or is API/CLI the only way?
Azure Static Web Apps
Azure Static Web Apps

An Azure service that provides streamlined full-stack web app development.


1 answer

Sort by: Most helpful
  1. AI answer

    2026-08-13T06:35:06.1833333+00:00

    The supported portal path for this setting is Settings > Configuration > Deployment configuration on the Static Web App resource. That is the documented place to choose the deployment authorization policy for an existing app. The Overview > Manage deployment token page is only for retrieving or resetting the token, not for changing the authorization policy.

    For an existing app:

    1. Open the Static Web App in Azure portal.
    2. Go to Settings > Configuration > Deployment configuration.
    3. Change the Deployment authorization policy to Azure deployment token.
    4. Save the change.
    5. Go back to Overview > Manage deployment token.
    6. Select Reset token.
    7. Copy the new token.
    8. In GitHub, open the repository Settings > Security > Actions.
    9. Update the AZURE_STATIC_WEB_APPS_API_TOKEN... repository secret with the new token.
    10. Rerun the workflow.

    If the workflow file targets a different branch than intended, update the branch names in the GitHub workflow. For some apps created during the preview period, changing the branch can also require resetting the deployment token.

    On the specific repositoryToken PAT scope/format question, the available documentation only states that Static Web Apps supports either an Azure deployment token or a GitHub access token as deployment authorization policies. It does not provide a supported PAT scope/format matrix for repositoryToken in the management API.

    On the API/CLI question, the documented UI for changing the policy is the Azure portal path above. The provided documentation does not describe a supported CLI or REST-only requirement for switching the policy.


    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.