Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when no credentials are set for DefaultAzureCredential #22635

Closed
vcolin7 opened this issue Jun 29, 2021 · 1 comment
Closed
Assignees
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library.
Milestone

Comments

@vcolin7
Copy link
Member

vcolin7 commented Jun 29, 2021

As reported by @JonathanGiles:

When I run an app on my Mac that has not got any credentials set up that DefaultAzureCredential can use, it is bad form to have a very long and scary exception message about PowerShell not being found when I am running on a MacBook – can we please make this error message nicer?

What I would like to see is way more context about how I am supposed to resolve this. Give links out to aka.ms links that explain to me what env vars I need to set, etc. The problem with this error message is that it tells me the problem without telling me enough on how to fix it.

We need to wrap and handle this more appropriately, as it pretty much kills the ability to graalvm native-image applications, as the IOException thrown on line 72 in the link below pretty much causes everything to come to a screaming halt.

Because we are trying to be helpful to users with the DAC, we need to be careful that if the environment is not what we expect that we don’t cause more trouble than benefit.

The error in question:

EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
ManagedIdentityCredential authentication unavailable. Connection to IMDS endpoint cannot be established, Connect timed out.
SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
IntelliJ Authentication not available. Please log in with Azure Tools for IntelliJ plugin in the IDE.
Failed to read Vs Code credentials from Mac Native Key Chain.
AzureCliCredential authentication unavailable. Please run 'az login' to set up account
Unable to execute PowerShell. Please make sure that it is installed in your system
    at com.azure.identity.ChainedTokenCredential.lambda$getToken$3 (ChainedTokenCredential.java:77)
...
Caused by: java.io.IOException: Cannot run program "pwsh": error=2, No such file or directory
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1128)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1071)
    at com.azure.identity.implementation.PowershellManager.lambda$initSession$0 (PowershellManager.java:62)
...
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessImpl.forkAndExec (Native Method)
    at java.lang.ProcessImpl.<init> (ProcessImpl.java:319)
    at java.lang.ProcessImpl.start (ProcessImpl.java:250)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1107)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1071)
    at com.azure.identity.implementation.PowershellManager.lambda$initSession$0 (PowershellManager.java:62)
...
@vcolin7 vcolin7 added Client This issue points to a problem in the data-plane of the library. Azure.Identity labels Jun 29, 2021
@vcolin7 vcolin7 added this to the [2021] August milestone Jun 29, 2021
@vcolin7 vcolin7 assigned g2vinay and vcolin7 and unassigned vcolin7 Jun 29, 2021
@g2vinay
Copy link
Member

g2vinay commented Oct 29, 2021

Resolved via #24512

@g2vinay g2vinay closed this as completed Oct 29, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

No branches or pull requests

2 participants