azure-sdk-for-net: Exception Message: Tried to get token using Azure CLI. Access token could not be acquired. after `az login

Describe the bug I cannot connect to my dev vault even after running az login

Exception or Stack TraceParameters: Connectionstring: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/b8495907-4bdc-4878-a828-a90219cad36f. Exception Message: Tried to get token using Azure CLI. Access token could not be acquired.

Code Snippet

                .ConfigureAppConfiguration((context, config) =>
                {
                    var name = $"{Environment.GetEnvironmentVariable("KEYVAULT_NAME")}";

                    Console.WriteLine(name);
                    var keyVaultEndpoint = $"https://{name}.vault.azure.net/";
                    var azureServiceTokenProvider = new AzureServiceTokenProvider();
                    Console.WriteLine(keyVaultEndpoint);
                    var keyVaultClient = new KeyVaultClient(
                        new KeyVaultClient.AuthenticationCallback(
                            azureServiceTokenProvider.KeyVaultTokenCallback));

                    config.AddAzureKeyVault(
                        keyVaultEndpoint, keyVaultClient, new DefaultKeyVaultSecretManager());
                })

Expected behavior To read the vault, it works on other machines

Setup (please complete the following information): No LSB modules are available. Distributor ID: LinuxMint Description: Linux Mint 18.2 Sonya Release: 18.2 Codename: sonya cescoferraro@desktop:

Additional context Add any other context about the problem here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

In the Arm64 camp. An alternative is to specify the location of the Azure-CLI via the AzureCLIPath environment variable.

AzureCLIPath="/opt/homebrew/bin" dotnet run