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.

`az login` fails: OSError: [WinError -2146892987]

See original GitHub issue

Describe the bug

When running Azure CLI on Microsoft.AzureStackHCI/clusters, az login fails:

> az login --use-device-code
az : WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code xxx to authenticate.
    + CategoryInfo          : NotSpecified: (WARNING: To sig...o authenticate.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: [WinError -2146892987] : ''
Traceback (most recent call last):
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\knack/cli.py', line 231, in invoke
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\azure/cli/core/commands/__init__.py', line 658, in execute
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\azure/cli/core/commands/__init__.py', line 721, in _run_jobs_serially
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\azure/cli/core/commands/__init__.py', line 692, in _run_job
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\azure/cli/core/commands/__init__.py', line 328, in __call__
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\azure/cli/core/commands/command_operation.py', line 121, in handler
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\azure/cli/command_modules/profile/custom.py', line 149, in login
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\azure/cli/core/_profile.py', line 153, in login
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\azure/cli/core/auth/identity.py', line 158, in login_with_device_code
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal/application.py', line 1608, in acquire_token_by_device_flow
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal/oauth2cli/oauth2.py', line 384, in obtain_token_by_device_flow
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal/oauth2cli/oauth2.py', line 346, in _obtain_token_by_device_flow
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal/oauth2cli/oidc.py', line 115, in _obtain_token
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal/oauth2cli/oauth2.py', line 789, in _obtain_token
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal/application.py', line 581, in lambda
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal/token_cache.py', line 307, in add
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal/token_cache.py', line 113, in add
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal/token_cache.py', line 184, in __add
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal_extensions/token_cache.py', line 49, in modify
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal_extensions/persistence.py', line 163, in save
  File 'D:\\a\\1\\s\\build_scripts\\windows\\artifacts\\cli\\Lib\\site-packages\\msal_extensions/windows.py', line 82, in protect
OSError: [WinError -2146892987] : ''
To open an issue, please run: 'az feedback'

Email: AKS on HCI | az login failing with unexpected error, probably known issue

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jiaslicommented, Jan 17, 2022

The workaround is to turn off token encryption: https://github.com/Azure/azure-cli/issues/20231#issuecomment-1007176901

0reactions
rayluocommented, Nov 17, 2022

I’m not using an interactive session, it’s all done through ansible playbooks.

@jiasli, those automation environment might not satisfy that implicit requirement. What if we change Azure CLI to automatically set encrypt_token_cache=false (and perhaps even persist it) upon encountering an encryption/decryption failure?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR Azure CLI behind a proxy that intercepts traffic
AZ LOGIN | ERROR Azure CLI behind a proxy that intercepts traffic. Hi,. Can anyone please help with this, currently I'm on VPN...
Read more >
azure cli not able login using command line option - Server Fault
When your account is Microsoft account(such as *@outlook.com, *@hotmail.com), you will get the error log. The root reason is Microsoft ...
Read more >
Use Azure CLI 2.0 behind corporate proxy server
By executing Azure login you will receive a TIMEOUT message- this is expected. ... Failed to establish a new connection: [WinError 10060].
Read more >
[Solved] Az login error while logging through chrome
PS C:\Users\Parag> az login. Port '8400' is taken with error '[WinError 10048] Only one usage of each socket address (protocol/network ...
Read more >
Github action pipeline keeps failing with Error: Az CLI Login ...
I am pretty new to github actions. the pipeline is supposed to deploy the app to azure. it runs three jobs, the first...
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