Azure / Azure/azure-cli-extensions
[account] az login fails
- Dominant language
- Python
- Stars
- 454
- Forks
- 1.7k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 64
Description
Source: https://github.com/Azure/azure-cli/issues/32371 (by @cnsegura)
Affected extension: `account` (`src/account/`)
---
<<>>
# Issue #32371 (by @cnsegura)
## Title
az login fails
## Body
### Describe the bug
I am attempting to use the az cli command "az login" to login to Azure from my corp-managed device and get the error added below.
This is on a corp managed device, which has full access to all internal services, shows as connected on the CompanyPortal etc.
I have updated to the latest cli and cleared the account info (via az account clear) and set the core.enable_broker_on_windows = true
with no change in behavior.
### Related command
no related commands - just az login
### Errors
az login
Select the account you want to log in with. For more information on login with Azure CLI, see https://go.microsoft.com/fwlink/?linkid=2271136
Retrieving tenants and subscriptions for the selection...
The command failed with an unexpected error. Here is the traceback:
argument of type 'NoneType' is not iterable
### Issue script & Debug output
NA
### Expected behavior
I can loginto Azure and view resources, subscriptions etc
### Environment Summary
azure-cli 2.78.0
core 2.78.0
telemetry 1.1.0
Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\ADMIN_chrisseg\.azure'
Extensions directory 'C:\Users\ADMIN_chrisseg\.azure\cliextensions'
Python (Windows) 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:06:58) [MSC v.1944 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
### Additional context
_No response_
## Comments
### Comment by @yonzhan
Thank you for opening this issue, we will look into it.
### Comment by @github-actions[bot]
Here are some similar issues that might help you. Please check if they can solve your problem.
- #17515
- #17514
------------
**Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)**
### Solution 1:
Known issue. See https://github.com/Azure/azure-cli/pull/17509 for details and quickfix.
**Reference**:
- https://github.com/azure/azure-cli/issues/17515#issuecomment-810134224
### Solution 2:
This is caused by an ongoing ARM service incident. Please see #17509.
**Reference**:
- https://github.com/azure/azure-cli/issues/17514#issuecomment-810096010
### Solution 3:
An **ugly** workaround without the patch #17509 is to use the hybrid profile:
'''
az cloud set --name AzureCloud --profile 2020-09-01-hybrid
az login
'''
As pointed out: setting `--profile 2020-09-01-hybrid` will cause other failures (like for `az aks`) because `2020-09-01-hybrid` has a reduced command set compared to latest.
**Reference**:
- https://github.com/azure/azure-cli/issues/17514#issuecomment-810122103
_Powered by [issue-sentinel](https://github.com/Azure/issue-Sentinel)_
### Comment by @jiasli
According to the internal email, the error happens in MSAL’s `msal/broker.py` file, at Line 59, in `_convert_error`:
https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/f0dec594f18b76afb422396e710b0834cbac352b/msal/broker.py#L59
''' py
"AADSTS50011" in context # In WAM, this could happen on both interactive and silent flows
'''
This issue should be investigated by MSAL.
### Comment by @microsoft-github-policy-service[bot]
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @josephkwchan, @jennyhunter-msft.
### Comment by @DharshanBJ
@jiasli, @yonzhan Based on the screenshot shared by Chris in the email thread regarding this issue, error.get_context() in _convert_error_ seems to be returning None, causing a TypeError: argument of type 'NoneType' is not iterable at line 59-60 in msal/broker.py. This is likely an error-handling bug in broker.py which is masking the actual underlying broker error.
The MSAL Python logs shared in the email thread shows error tag 7q6ch, which maps to an Unexpected WAM provider error. The system error code 3489661028 corresponds to STATUS_NO_SUCH_USER - "The specified account does not exist."
We need WAM logs to further investigate this.
### Comment by @DharshanBJ
@jiasli / @yonzhan , is the user still encountering this issue? Do we need to track this?
### Comment by @jennguye
I have the same issue...
<<>>
Contributor guide
Assessment
This issue has not been assessed yet.