skip to Main Content

On the server the azure key-vault connection in the web app works fine but constantly throws an error-
{"error":{"code":"Unauthorized","message":"[TokenExpired] Error validating token: ‘S2S12086’."}}.

Right now the web-app is being restarted whenever the azure key-vault connection fails.

Packages used to for Azure keyvault connection :
@azure/identity[version 2.0.4] @azure/keyvault-secrets[version 4.3.0]

Any help would be appreciated.Thank you

2

Answers


  1. This error may cause if the keyvault unable to authenticate web app. Please check whether you enable system assigned managed identity as below.

    In your web app service -> identity -> system assigned -> Enable

    enter image description here

    And in keyvault -> access policy -> add access policy rule set Get and List permission

    enter image description here
    enter image description here

    In select principal add your web app name add and save.

    enter image description here

    After adding this keyvault can authorized web application connection try to stop & start application and after sometime refresh again and again.


    Alternatively, default setting for Access Token expiration is seven days. try to delete any local information, change the expiration of the AccessToken as per document

    For your Reference:

    Azure Key Vault web service Error code

    Connector returns [TokenExpired] Error validating token: ‘S2S12086’. after some time. by jyoung

    Login or Signup to reply.
  2. For anyone coming to this issue recently, there appears to be a regression in the @azure/identity package as of version 2.1.0 that is causing this issue.

    See https://github.com/Azure/azure-sdk-for-js/issues/22722 for context.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search