I am using Azure.Identity 1.7 and using VS 2022 , trying to get the token using DefaultAzureCredential,
var tokenCredential = new DefaultAzureCredential();
var accessToken = await tokenCredential.GetTokenAsync(new TokenRequestContext(new[] { _configuration.GetSection("scope")?.Value }));
I am log in with my credential everwhere, VS 2022, powershell, azure cli, but still I am getting below error while trying to get token,
What I am missing here?
Error message: Azure PowerShell authentication failed due to an unknown error. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/powershellcredential/troubleshoot #< CLIXML x001B[91mGet-AzAccessToken: x000D__x000Ax001B[96mLine |x000D__x000Ax001B[96m 12 | x001B[0m $token = x001B[96mGet-AzAccessToken -ResourceUrl 'api://d39cb913-ef82-48ba-9b1_x001B_[0m .x000D__x000Ax001B[96m | x001B[91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~x000D__x000Ax001B[91m_x001B_[96m | x001B[91mSharedTokenCacheCredential authentication unavailable. Token acquisition failed for user aa.bb@cc.com. Ensure that you have authenticated with a developer tool that supports Azure single sign on.