Azure / Azure/azure-cli

az login fails when -u option used

Open
#23,036 8 comments 0 reactions 1 assignee Claimed by @jiasli View on GitHub
Account act-identity-squad Auto-Assign customer-reported
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug
If I login with sz login -u gsuggitt@imstsvc.com I will get the following error. This happens if
(a) i enter the password with the -p option
(b) i enter an invalid password with the -p option
(c) i do not use the -p option and I enter the password at the "Password" promt
(d) i do not use the -p option and I enter an invalid passowrd at the "Password" prompt

If I just login with az login, I get the webpage to select the user to use. And this works.
I have two users logged in - my personal name and a name used by my corportation.

**Command Name**
`az login`

**Errors:**
```
The command failed with an unexpected error. Here is the traceback:
no element found: line 1, column 0
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 663, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, 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 139, in login
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/_profile.py", line 157, in login
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/auth/identity.py", line 156, in login_with_username_password
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 1460, in acquire_token_by_username_password
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/application.py", line 1487, in _acquire_token_by_username_password_federated
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/wstrust_request.py", line 60, in send_request
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/wstrust_response.py", line 48, in parse_response
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msal/wstrust_response.py", line 52, in parse_error
File "xml\etree\ElementTree.py", line 1350, in XML
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- _Put any pre-requisite steps here..._
- `az login -u {} -p {}`

(see above in description of problem)

## Expected Behavior
I get logged in!

## Environment Summary
```
Windows-10-10.0.19044-SP0
Python 3.10.4
Installer: MSI

azure-cli 2.37.0
```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.