Azure / Azure/azure-cli

`az login` not honoring `core.login_experience_v2 = off`

Open
#30,109 6 comments 1 reaction 1 assignee Claimed by @jiasli View on GitHub
Account act-codegen-extensibility-squad act-identity-squad Auto-Assign Azure CLI Team Configure customer-reported question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### 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:

```shell
$ 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:

```shell
$ 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:

```shell
$ 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

```text
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

```text
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_

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.