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

Connect-MgGraph Fails, "Key not valid for use in specified state" #554

Closed
gabrieljtaylor opened this issue Feb 10, 2021 · 6 comments
Closed
Assignees
Labels
Milestone

Comments

@gabrieljtaylor
Copy link

gabrieljtaylor commented Feb 10, 2021

Issue Summary:
Connect-MgGraph fails regardless of parameters (or lackthereof) supplied to it, always citing the same error - "Key not valid for use in specified state."

Environment:
Module Version = Microsoft.Graph.* module versions 1.3.1
PowerShell Version(s) = 7.1.1, 5.1.19041.610
Terminals experiencing the issue = Windows Terminal, Visual Studio Code integrated terminal, native Windows cmd.exe terminal
Operating System = Windows 10 version 20H2, OS Build 19042.804

What I've Tried So Far:

  • I've tried Connect-MgGraph (and the alias Connect-Graph) with no parameters at all, with Scopes provided, with TenantId provided, with ForceRefresh provided, and combinations thereof, in every terminal and PS version listed above, and the same error is always generated.
  • I've tried changing the profile from v1.0 to beta via Set-MgProfile; the results are the same.
  • I've tried running Disconnect-MgGraph to make sure nothing is cached, receiving the message "No application to sign out from".
  • I've completely uninstalled the module, ensuring the folders and files are all removed, restarted my computer, and reinstalled the module from scratch, same error.

I'm guessing this issue isn't widespread due to the lack of others reporting the issue, but I've not been able to identify what is unique about my situation that is causing the issue. If there is any further data I can share to assist, let me know and I'll do so.
AB#8104

@ghost ghost added the ToTriage label Feb 10, 2021
@georgend
Copy link
Contributor

@gabrieljtaylor Please provide us with the output of Connect-Graph -Debug -Verbose

@georgend georgend self-assigned this Feb 15, 2021
@ghost ghost removed the ToTriage label Feb 15, 2021
@gabrieljtaylor
Copy link
Author

@finsharp - Unfortunately, Connect-Graph -Debug -Verbose was surprisingly unhelpful, just resulting in the same error:

image

What other information can I supply you with?

@peombwa
Copy link
Member

peombwa commented Feb 18, 2021

@gabrieljtaylor I can't repro the bug locally, but this looks like a bug in the authentication library we use - AzureAD/microsoft-authentication-library-for-dotnet#2352. We will bump MSAL to the latest version as part of #534 .

For now, could you try deleting .graph folder in C:\Users\{Your-UserName}\ and try again.

@gabrieljtaylor
Copy link
Author

@peombwa - deleting the .graph folder did the trick - after doing so and restarting PowerShell, Connect-MgGraph behaved normally and prompted for device login as expected. Thank you very much!

@kayasax
Copy link

kayasax commented Mar 4, 2022

@peombwa - deleting the .graph folder did the trick - after doing so and restarting PowerShell, Connect-MgGraph behaved normally and prompted for device login as expected. Thank you very much!

thanks for the tip !
.graph folder is in the userprofile folder ;)

@Leviani
Copy link

Leviani commented Jan 5, 2024

Wow, seems like this bug is still not fixed, I am having the same issue, and only the .graph folder deletion helped :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants