I am using ChainedTokenCredential and trying to get managed identity token in local debug environment using Visual Studio 2019. In windows terminal I already logged in using Azure CLI az login.
var credential = new ChainedTokenCredential(
new ManagedIdentityCredential(),
new AzureCliCredential());
var token = await credential .GetTokenAsync(new TokenRequestContext(new[] { _configuration.GetSection("scope").Value }));
When I am running code in debug I am seeing below error,
The ChainedTokenCredential failed to retrieve a token from the included credentials. ManagedIdentityCredential authentication unavailable. No Managed Identity endpoint found. Please run 'az login' to set up account
Where I need to do az login? Thanks.
Execute az logout first and try again az login and I suggest to set default subscription by executing az account set -s "Subscription ID"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With