Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AzureCliCredential giving error, Please run 'az login' to set up account

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.

like image 965
user584018 Avatar asked Oct 27 '25 04:10

user584018


1 Answers

Execute az logout first and try again az login and I suggest to set default subscription by executing az account set -s "Subscription ID"

like image 127
dev4java Avatar answered Oct 30 '25 14:10

dev4java



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!