Blazor WASM in Azure Static Web Apps 404 when authenticating with Entra ID

Just a quick post on how to solve an issue where an Azure Static Web App with Blazor WASM and Entra ID sign-in causes a 404 not found when redirected back to authentication/login.

Essentially, in your Blazor WASM project you will have a web.config that should fix this, but is not compatible with Azure Static Web Apps:

To workaround this, simply place a staticwebapp.config.json file in your wwwroot folder with the following contents:

{
    "navigationFallback": {
        "rewrite": "/index.html"
    }
}

This will cause all navigation to point to index.html and your Blazor WASM app.

3 thoughts on “Blazor WASM in Azure Static Web Apps 404 when authenticating with Entra ID

Leave a reply to marc Cancel reply