question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Cannot connect to KeyVault on Mac OS X

See original GitHub issue

Describe the bug I’m running a .NET Framework project on Mac under mono and trying to use KeyVault but cannot get get access token due to Windows CLI command is used instead of Bash command. According to the output, “cmd.exe” is used, although the source for tag “1.2.0” indicates the Bash command should be used is OS is not Windows.

Exception or Stack Trace

[ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProviderException: Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/05392f7e-58e6-4648-9ee2-95041f83c964. Exception Message: Tried the following 4 methods to get an access token, but none of them worked.
Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/05392f7e-58e6-4648-9ee2-95041f83c964. Exception Message: Tried to get token using Managed Service Identity. Unable to connect to the Managed Service Identity (MSI) endpoint. Please check that you are running on an Azure resource that has MSI setup.
Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/05392f7e-58e6-4648-9ee2-95041f83c964. Exception Message: Tried to get token using Visual Studio. Access token could not be acquired. Environment variable LOCALAPPDATA not set.
Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/05392f7e-58e6-4648-9ee2-95041f83c964. Exception Message: Tried to get token using Azure CLI. Access token could not be acquired. ApplicationName='cmd.exe', CommandLine='/c az account get-access-token -o json --resource https://vault.azure.net', CurrentDirectory='', Native error= Cannot find the specified file
Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/05392f7e-58e6-4648-9ee2-95041f83c964. Exception Message: Tried to get token using Active Directory Integrated Authentication. Access token could not be acquired. secur32.dll

To Reproduce Run a .NET Framework 4.6.1 project and try to connect to KeyVault on Mac OS X

Code Snippet Add the code snippet that causes the issue.

Expected behavior The expected behaviour would be that the AzureCliAccessTokenProvider would use the Bash command.

Setup (please complete the following information):

  • OS: Mac OS X (Output from Runtime OSDescription: Unix 18.6.0.0)
  • IDE : Jetbrains Rider
  • Microsoft.Azure.Services.AppAuthentication 1.2.0
  • Mono 5.18.1.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Rorschachlycommented, Sep 23, 2020

I am having the same issue as @soydachi does (MacOS). Please help us!

The only solution for me now is to restart the laptop and try to wait for 2 minutes, then open Visual Studio 2019 and click run. It only works sometimes. So it cannot be a long time solution.

0reactions
anaim3commented, Dec 18, 2021

Hi, thanks for your reply its working on viscose although I had to change the target framework from 3.1 to 6.0.1

now how can I make it work on Visual studio ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Key Vault secret access intermittently failing to ...
The project uses the Microsoft.Azure.KeyVault 3.0.3 NuGet package and the secrets are accessed using the KeyVaultClient and .GetSecretAsync() .
Read more >
Code Sign using Azure Key Vault
I need an OV certificate to code sign an Electron application. I was used to build in Jenkins the application oth for Windows...
Read more >
Troubleshooting Azure Key Vault access policy issues
With Azure RBAC, you can redeploy the key vault without specifying the policy again. You can read more this solution here.
Read more >
KeyVaultClient.GetSecretAsync not working after update ...
I'am using the KeyVaultClient to get secrets from Azure KeyVault. ... Access token could not be acquired. get_user_name_failed: Failed to get user nameInner ......
Read more >
azure-keyvault-secrets 4.7.0
Azure Key Vault helps solve the following problems: Secrets management (this library) - securely store and control access to tokens, passwords, certificates, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found