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

[BUG] DefaultAzureCredential AzurePowerShellCredential fails with AuthenticationFailedException when not logged in #23498

Closed
jongio opened this issue Aug 24, 2021 · 0 comments · Fixed by #26868
Assignees
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library.

Comments

@jongio
Copy link
Member

jongio commented Aug 24, 2021

Describe the bug

Using DAC.

Fails with:

"Azure PowerShell authentication failed due to an unknown error. #< CLIXML\r\n<Objs Version=\"1.1.0.1\" xmlns=\"http://schemas.microsoft.com/powershell/2004/04\"><S S=\"Error\">_x001B_[91mGet-AzAccessToken: _x000D__x000A_</S><S S=\"Error\">_x001B_[96mLine |_x000D__x000A_</S><S S=\"Error\">_x001B_[96m  12 | _x001B_[0m $token = _x001B_[96mGet-AzAccessToken -ResourceUrl 'https://vault.azure.net'_x001B_[0m_x000D__x000A_</S><S S=\"Error\">_x001B_[96m     | _x001B_[91m          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S S=\"Error\">_x001B_[91m_x001B_[96m     | _x001B_[91mCannot retrieve access token for resource 'https://vault.azure.net';. Please ensure that you have provided the appropriate access tokens when using access token login._x001B_[0m_x000D__x000A_</S></Objs>"

Expected behavior

If PSH fails I expect it to bubble up with the normal aggregated DAC exception.

I think we should make sure we have a test that covers "Has AzPSH installed, but not logged in"

Actual behavior (include Exception or Stack Trace)

Right now it fails and throws an exception.

To Reproduce
Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)

  1. Log out of all dev tools - including PowerShell
  2. New up a DAC
  3. Run it.
  4. Get the exception

Environment:

  • Name and version of the Library package used: [e.g. Azure.Storage.Blobs 12.2.0]
    <PackageReference Include="Azure.Identity" Version="1.5.0-beta.3"/>
    <PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.3.0-beta.1"/>

I also tried with the GA version.

❯ $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      1      4
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): [e.g. Azure AppService or Windows 10 .NET Framework 4.8]

Windows 10

  • IDE and version : [e.g. Visual Studio 16.3]

VS Code

azsdke2e
azsdke2e1

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 24, 2021
@christothes christothes self-assigned this Aug 24, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 24, 2021
@jsquire jsquire added the Client This issue points to a problem in the data-plane of the library. label Aug 27, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 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
3 participants