`az login` fails with "Please select the account you want to log in with" when using WAM
Describe the bug
az login fails with:
WARNING: Please select the account you want to log in with.
If I disable WAM, then the browser popup happens, and there I can chose between my normal corp account, or my SC-Alt account.
Related command
az login
Errors
$ az login WARNING: Please select the account you want to log in with.
Issue script & Debug output
$ az login --debug
DEBUG: cli.knack.cli: Command arguments: ['login', '--debug']
DEBUG: cli.knack.cli: init debug log:
Cannot enable color.
DEBUG: cli.knack.cli: Event: Cli.PreExecute []
DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x0000017FB00AF880>, <function OutputProducer.on_global_arguments at 0x0000017FB02360C0>, <function CLIQuery.on_global_arguments at 0x0000017FB0263C40>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: cli.azure.cli.core: Modules found from index for 'login': ['azure.cli.command_modules.profile']
DEBUG: cli.azure.cli.core: Loading command modules:
DEBUG: cli.azure.cli.core: Name Load Time Groups Commands
DEBUG: cli.azure.cli.core: profile 0.021 2 8
DEBUG: cli.azure.cli.core: Total (1) 0.021 2 8
DEBUG: cli.azure.cli.core: Loaded 2 groups, 8 commands.
DEBUG: cli.azure.cli.core: Found a match in the command table.
DEBUG: cli.azure.cli.core: Raw command : login
DEBUG: cli.azure.cli.core: Command table: login
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x0000017FB318E340>]
DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\austind.azure\commands\2024-06-17.15-42-36.login.15428.log'.
INFO: az_command_data_logger: command args: login --debug
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.
Expected behavior
az login should popup WAM, to let me chose which of my 2 accounts I'd like to use.
Environment Summary
$ az --version azure-cli 2.61.0
core 2.61.0 telemetry 1.1.0
Dependencies: msal 1.28.0 azure-mgmt-resource 23.1.1
Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe' Extensions directory 'C:\Users\austind.azure\cliextensions'
Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
Work-around is to disable WAM:
az config set core.enable_broker_on_windows=false
Thank you for opening this issue, we will look into it.
+1
+1
+1
I've updated to az version 2.63.0 and this no longer repros for me. I see WAM pop up and I get to chose which account to use.
$ az --version
azure-cli 2.63.0
core 2.63.0
telemetry 1.1.0
Extensions:
azure-cli-ml 1.41.0
Dependencies:
msal 1.30.0
azure-mgmt-resource 23.1.1
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\austind\.azure\cliextensions'
Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 21:52:07) [MSC v.1937 32 bit (Intel)]
Same here. I followed this steps without success:
Sign into Azure interactively using the Azure CLI
Also, I tried to use the "Sign in to an organization" and it seems there's another issue related:
az login --use-device-code fails with "Sign in to an organisation"
This worked for me.
1st run the below code to manually input login info. It errored due to MFA requirement. Then I re-ran Connect-AzAccount and it worked.
$credential = Get-Credential Connect-AzAccount -Credential $credential
The issue description contains no error message. WARNING: Please select the account you want to log in with. is not an error. It is only a warning indicating the WAM window is popped up.
Do you mean you are not seeing the WAM window?
That's correct - there's no WAM popup. The az login prints the WARNING message, but exits without showing WAM UI.
Also, I should point out that this might depend on the version of Windows OS that's running. I can no longer repro this bug, and I'm running Windows 11 24H2 (OS Build 26120.2130) That's the ge_release_upr.
Seeing this error via Powershell ISE and VCode on Windows 10 22H2
VSCode version 1.94.2 system setup
Name Value
PSVersion 7.4.6 PSEdition Core
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
Unexpected exception while waiting for accounts control to finish: '(pii)'. Status: Response_Status.Status_Unexpected, Error code: -2147023584, Tag: 528315211
Please explicitly log in with:
az login
ISE - PSVersion 5.1.19041.5129
C:\windows\system32> az login
az : WARNING: 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
At line:1 char:1
+ az login
+ ~~~~~~~~
+ CategoryInfo : NotSpecified: (WARNING: Select...?linkid=2271136:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
ERROR: Unexpected exception while waiting for accounts control to finish: '(pii)'. Status: Response_Status.Status_Unexpected, Error code: -2147023584, Tag: 528315211
Please explicitly log in with:
az login
az cli 2.66.0 installed via MSI
Just got this myslef.
It turns out a graphical login prompt is raised in the background. After minimizing all my windows i found it in the background.
Please let me know if you need any more information.
When I do an az login the login prompt appears at the back of other windows open with no notification.
I found this out just by luck
I can no longer repro this bug