CredentialUnavailableException: ManagedIdentityCredential authentication unavailable. Multiple attempts failed to obtain a token from the managed identity endpoint.

SohamPrasad Girde (Wipro Designit Services, Inc.) 40 Reputation points Microsoft External Staff
2024-07-19T04:58:19.1766667+00:00

Hi there , I am trying to migrate managed identity into my application and removing credentials but getting below error and looking for support.

CredentialUnavailableException: ManagedIdentityCredential authentication unavailable. Multiple attempts failed to obtain a token from the managed identity endpoint.

Additional details
I am using KUSTO database to read and write data.

I am hoping to get the solution soon , Thanks in Advance..

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Entra | Other
0 comments No comments
{count} votes

Accepted answer
  1. Akhilesh Vallamkonda 15,320 Reputation points Microsoft External Staff Moderator
    2024-08-07T10:54:28.1566667+00:00

    Hi @SohamPrasad Girde (Wipro Designit Services, Inc.)

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.Issue:you're trying to migrate managed identity into my application and removing credentials but getting below error and looking for support.CredentialUnavailableException: ManagedIdentityCredential authentication unavailable. Multiple attempts failed to obtain a token from the managed identity endpoint.

    Solution:

    With the reference of the below document https://learn.microsoft.com/en-us/azure/azure-app-configuration/howto-integrate-azure-managed-service-identity?pivots=framework-dotnet
    you have created the managed identity, and you have assigned to app service as a user managed identity, which fix the issue.

    If you have any other questions or are still running into more issues, please let me know. Thank you again for your time and patience throughout this issue.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Akhilesh Vallamkonda 15,320 Reputation points Microsoft External Staff Moderator
    2024-07-23T10:19:29.5233333+00:00

    Hi @SohamPrasad Girde (Wipro Designit Services, Inc.)
    Thank you for reaching us!
    Could you please check the Managed Identity is enabled for your Azure resource and verify that that the Managed Identity has the necessary roles.

    If your application is running in virtual network or firewall, ensure that it has access to the Managed Identity endpoint. The endpoint is located at http://169.254.169.254/metadata/identity/oauth2/token .

    Also, could you check the logs of your application and azure services which gives and additional insights of the issue.

    Hope this helps. Do let us know if you any further queries.


  2. SohamPrasad Girde (Wipro Designit Services, Inc.) 40 Reputation points Microsoft External Staff
    2024-08-05T13:40:34.8033333+00:00

    This is resolved

    0 comments No comments

Your answer

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