azure-functions-host: BUG : Unexpected JWT Validation Exception - IDX10205: Issuer validation failed

Recent Azure Functions Deployment is appearing to perform Token Validation resulting in “IDX10205: Issuer validation failed” log level message. JWT auth is not configured or expected. Earlier runtime version 4.35 did not exhibit this behaviour. Redeploying of the same code (no issue) with runtime 4.35, new deployment defaults to latest runtime 4.136 will produced this error.

Azure App Service with EasyAuth on / off does not change this behavour.

I should not experience JWT validation issues.

Runtime Stack: DOTNET-ISOLATED|8.0 Runtime/SDK Version: 4.1036.2.2 OS: Linux Plan: Premium V2 Region: WEU & UKS

Error : IDX10205: Issuer validation failed. Exception Type : Microsoft.IdentityModel.Tokens.SecurityTokenInvalidIssuerException

Microsoft.IdentityModel.Tokens.SecurityTokenInvalidIssuerException: at Microsoft.Extensions.DependencyInjection.ScriptJwtBearerExtensions.IssuerValidator (Microsoft.Azure.WebJobs.Script.WebHost, Version=4.1036.0.0, Culture=neutral, PublicKeyToken=null: /src/azure-functions-host/src/WebJobs.Script.WebHost/Security/Authentication/Jwt/ScriptJwtBearerExtensions.cs:152) at Microsoft.IdentityModel.Tokens.Validators+<ValidateIssuerAsync>d__7.MoveNext (Microsoft.IdentityModel.Tokens, Version=6.35.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.IdentityModel.Tokens.Validators.ValidateIssuer (Microsoft.IdentityModel.Tokens, Version=6.35.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at Microsoft.IdentityModel.Tokens.InternalValidators.ValidateAfterSignatureFailed (Microsoft.IdentityModel.Tokens, Version=6.35.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature (System.IdentityModel.Tokens.Jwt, Version=6.35.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignatureAndIssuerSecurityKey (System.IdentityModel.Tokens.Jwt, Version=6.35.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateJWS (System.IdentityModel.Tokens.Jwt, Version=6.35.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken (System.IdentityModel.Tokens.Jwt, Version=6.35.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler+<HandleAuthenticateAsync>d__6.MoveNext (Microsoft.AspNetCore.Authentication.JwtBearer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)

Packages used.

<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="FluentResults" Version="3.16.0" />
<PackageReference Include="FluentResults.Extensions.AspNetCore" Version="0.1.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.10.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenApi" Version="1.5.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />

Function Header

public async Task<IActionResult> Run ( [HttpTrigger(AuthorizationLevel.Anonymous, “POST”, Route = “Test/Test”)] HttpRequest httpRequest ) => …

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 14
  • Comments: 28 (5 by maintainers)

Most upvoted comments

Want to share an update.

We have so far identified this to be only a change in logging with the 4.10xx versions of the host. Specifically, these exceptions and errors do occur in previous versions (as verified by tests). However, previously they were never sent to customer logs.

We will continue to look into this to see if we can avoid emitting the error log.

Mitigation

For the time being, you can filter this error log via a log filter for Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler, with a level of Warning. This can be done in either host.json or as an app setting.

Via host.json:

{
  "Logging": {
    "ApplicationInsights": {
        "LogLevel": {
            "Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler": "Warning"
        }
    }
  }
}

via app setting:

Key: Logging__ApplicationInsights__LogLevel__Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler
Value: Warning

We have found this to be a problem with the AAD Graph to MS Graph transition accidentally breaking the contract in OAuth2 by changing the issuer.

See here: AAD Graph Manifest Deprecation

The way Enterprise Application manifest is processed for the App registration for the hosted function means that the client will default to using the graph.microsoft.com token issuer rather than the sts.windows.net issuer if either apiAccessTokenAcceptedVersion or requestedAccessTokenVersion are NOT SET.

This is fixable by force setting the apiAccessTokenAcceptedVersion or requestedAccessTokenVersion key to the correct version in the api entity in the app registration in Entra.

for sts.windows.net use 1, for graph.microsoft.com use 2.

Make sure this is matched in your Easy Auth configuration in App Service.

The below snippet forces the value of the issuer to 1, which was the original implicit default.

    $body = '{\"api\":{\"requestedAccessTokenVersion\":1}}'
    
    & az rest --method PATCH `
                --url "https://graph.microsoft.com/v1.0/applications/$objectId" `
                --headers Content-Type=application/json `
                --body ($body)

Can post more detail on request - but this is our good summary.

I’m getting this error in 2025, is this an issue still?

We have been having this issue as well, this started 2 weeks ago in our East US region but has now spread to our other regions as well.

They are all running version 4.1036.3.23284. I forcefully set the FUNCTIONS_EXTENSION_VERSION to 4.36.0.23246 (without the ~). This has fixed the issue for now.

Hopefully this issue will be resolved.

it will be fixed with the next runtime update, at some point before end of Feb, according to the comment in the fix

https://github.com/Azure/azure-functions-host/pull/10617#issuecomment-2512181717

@dggsax I recommend trying with the logging.applicationInsights.logLevel section first, then trying logging.logLevel after if it doesn’t address this.

Hi! Having the same problem on Azure functions for Node.

SDK version 4.1036.3.23284

Invocation ID 1b024620d0dc4d61bebf92e6a1b710e9, West Europe on 2024-11-05T07:48:12.8156859Z.

Fortunately the exception is only logged and doesn’t crash the app for now…

Thank you all for reporting. We’re actively looking at this and will provide updates as more information is available.