Skip to content

az account get-access-token doesnt seem to work in multi-tenant scenarios correctly #21227

@digitalinfinity

Description

@digitalinfinity

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

If you log in to az cli with multiple tenants, and then run az account get-access-token with --tenant-id, it fails to retrieve the tenant. However, if you use --subscription with a subscription in that tenant, it works.

To Reproduce

az login (into tenant A)
az login --device-code (into tenant B)
az account get-access-token --scope "https://vault.azure.net/.default" --tenant <id of tenant B>
az account get-access-token --scope "https://vault.azure.net/.default" --tenant <id of tenant A>
az account get-access-token --scope "https://vault.azure.net/.default" --subscription <subscription in tenant A>

Here, the first get-access-token call succeeds, the second fails, and the third succeeds.

Expected behavior

All three get-access-token calls succeed

Environment summary

az cli 2.33.0 running on WSL2

Additional context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions