Fail to create Static Web App

Bobby Stewart 0 Reputation points
2026-10-11T18:47:11.6433333+00:00

Creating web app connected to GitHub. Get this when committing:

The content server has rejected the request with: BadRequest

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

Troubleshooting so far:

  • Static Web App recreated
  • Deployment token regenerated
  • GitHub secret recreated
  • GitHub repository linked
  • Branch linked
  • Workflow regenerated by Azure
  • Secret successfully injected into workflow (length 119)
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-10-11T18:47:24.5666667+00:00

    For this error, the supported fix is to create the Azure Static Web App using the Deployment token option instead of linking it directly to GitHub during creation, then use that newly created token in the GitHub Actions workflow.

    Based on the documented resolution for this exact symptom:

    1. Create a new Static Web App.
    2. During creation, choose Deployment token rather than the direct GitHub-linked setup.
    3. Use the new deployment token generated by that app.
    4. Update the GitHub Actions secret used by the workflow with that new token.
    5. Run the workflow again.

    Since these steps were already tried in part, the key detail is that the token must come from a Static Web App that was created with the Deployment token path. In the documented case, the error was not caused by an expired or malformed token; it was caused by the initial Static Web App setup.

    If the deployment still fails, check the GitHub Actions run logs to confirm whether the failure is still the API key validation step or whether the issue has moved to build or folder configuration:

    1. Open the GitHub repository.
    2. Select Actions.
    3. Open the failed workflow run.
    4. Select Build and Deploy Job.
    5. Select Build And Deploy.
    6. Review the log output.

    If the logs show folder-related errors instead, verify the workflow folder settings match the repository structure:

    • App Directory Location must point to a real folder.
    • Output location must match the actual build artifact folder.
    • Api location should be empty if no Azure Functions API is being deployed.

    References:

    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.