Alexei Levenkov
Alexei Levenkov

Reputation: 100545

TS003: Error, TS001: Please go to Tools->Azure Services Authentication, and re-authenticate the account you want to use

Got following exception (on GetSecretAsync call):

'TS003: Error, TS001: This account 'XXXXXXX' needs re-authentication. Please go to Tools->Azure Services Authentication, and re-authenticate the account you want to use.

when using standard Azure auth code from How to use managed identities...

var azureServiceTokenProvider = new AzureServiceTokenProvider();
var kv = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(
      azureServiceTokenProvider.KeyVaultTokenCallback));
var secret = await 
kv.GetSecretAsync("https://myvault.vault.azure.net/secrets/mysecret");

Could not find "Tools->Azure Services Authentication" anywhere in VS 2019...

There are some similar questions but none tells if that tool is anywhere in VS 2019.

Upvotes: 6

Views: 3825

Answers (3)

eddex
eddex

Reputation: 2152

In Jetbrains Rider, go to File > Settings... > Tools > Azure > Azure Identity.

If you see a message like "You're not authenticated, run az login", open the built in terminal in Rider (it didn't work for me using an external PowerShell window!) and run az login.

Then open File > Settings... > Tools > Azure > Azure Identity again and you should be able to click the login button, select your tenant and now everything should work.

Upvotes: 0

Sora Teichman
Sora Teichman

Reputation: 184

If you're using VS Code, you can install the Azure Account extension. Once the extension is installed, press F1 to open the command palette and run the Azure: Sign In command.

Upvotes: 0

Alexei Levenkov
Alexei Levenkov

Reputation: 100545

Turned out that this menu moved to Tools->Options - https://github.com/Azure/azure-sdk-for-net/issues/4091

Tools->Options->Azure Services Authentication

If you could not find the option in your Visual Studio make sure "Azure Development" workload is installed by launching Visual Studio Installer and then selecting "Modify" for VS 2019.

Note that if you have VS configured to break on all exceptions the exception may happen even if everything is fine and it gets handled internally with GetSecretAsync successfully finishing.

Upvotes: 10

Related Questions