`az login` not honoring `core.login_experience_v2 = off`
Describe the bug
When using az login --allow-no-subscriptions --tenant 'abcd1234-1234-1234-1234-1234abcd1234' --output none it does not honor the local configuration file.
Related command
Set the local config to not use the interactive login experience:
$ az --version
azure-cli 2.61.0
$ az config --local set core.login_experience_v2=off
Verify that local config has core.login_experience_v2 disabled and global config is unset:
$ az config get core.login_experience_v2
Configuration 'core.login_experience_v2'is not set.
$ az config get --local core.login_experience_v2
{
...
"value: "off"
}
Try to connect specifying a tenant id:
$ az login --allow-no-subscriptions --tenant 'abcd1234-1234-1234-1234-1234abcd1234' --output none
However, it prompts the user to select a subscription. If global config is set to core.login_experience_v2=off then there's no prompt.
Errors
No errors
Issue script & Debug output
Retrieving tenants and subscriptions for the selection...
[Tenant and subscription selection]
No Subscription name Subscription ID Tenant
----- --------------------------------- ------------------------------------ ---------
[1] Some sub 1231123123 Some tenant
Expected behavior
az login --allow-no-subscriptions --tenant 'abcd1234-1234-1234-1234-1234abcd1234' --output none should not prompt the user to select a subscription
Environment Summary
azure-cli 2.65.0
core 2.65.0
telemetry 1.1.0
Extensions:
account 0.2.5
automation 1.0.0b1
init 0.1.0
next 0.1.3
Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1
Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\danmacode\.azure\cliextensions'
Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]
Additional context
No response
Thank you for opening this issue, we will look into it.
Workaround to avoid modifying the global configuration at ~/.azure/config:
az config --local set core.login_experience_v2=off
export AZURE_CONFIG_DIR="$(pwd)"
# execute the rest of your az commands below
The above noted workaround does not work...I get an error saying that --local is an unrecognized argument.
My company has a tenant with over 100,000 subscriptions in it. The inability to use the AZ CLI is a problem for us, and this would be very simple to fix.
The correct command is
az config set --local core.login_experience_v2=off
You cannot put --local before set.
After running it, the config will be logged at .azure/config under the current directory.
> az config get --local
...
"core": [
{
"name": "login_experience_v2",
"source": "D:\\temp\\.azure\\config",
"value": "off"
},
However, it is not honored during command execution. Actually, it is not login_experience_v2 that doesn't work with local config, but all configuration options.
This issue is tracked by https://github.com/Azure/azure-cli/issues/22007.
@jiasli I don't actually care that the local config isn't honored. What I care about is that the --allow-no-subscriptions switch doesn't do anything. The AZ CLI is utterly unusable for any customer having more than X subscriptions in a tenant.
This feels like a really small fix to an issue that's been opened for years.
Do I need to make a duplicate of this issue that focuses exclusively on the fact that --allow-no-subscriptions is ignored (irrespective of login_experience_v2)?