How to Authenticate Azure service using managed Identity

Patil, Kiran 20 Reputation points
2024-03-15T14:15:42.1066667+00:00

Hi Team,

I am trying to authenticate azure service with managed identity but it shows below error however all required accesses are given to identity.

Code -


string userAssignedClientId = "AAABBBBCCCC";

var defaultAzureCredentialOptions = new DefaultAzureCredentialOptions

{				

  ManagedIdentityClientId = userAssignedClientId,

 ExcludeEnvironmentCredential = true,

 ExcludeSharedTokenCacheCredential = true,

 ExcludeVisualStudioCredential = true,

 ExcludeAzureCliCredential = true,

ExcludeVisualStudioCodeCredential = true				

};

var client = new ArmClient(new DefaultAzureCredential(defaultAzureCredentialOptions));  

Error -
DefaultAzureCredential failed to retrieve a token from the included credentials. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/defaultazurecredential/troubleshoot

  • WorkloadIdentityCredential authentication unavailable. The workload options are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/workloadidentitycredential/troubleshoot
  • ManagedIdentityCredential authentication unavailable. Multiple attempts failed to obtain a token from the managed identity endpoint.
  • Az.Account module >= 2.2.0 is not installed.
  • Azure Developer CLI could not be found.
Microsoft Identity Manager
Microsoft Identity Manager
A family of Microsoft products that manage a user's digital identity using identity synchronization, certificate management, and user provisioning.
706 questions
{count} votes

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.