az account get-access-token doesnt seem to work in multi-tenant scenarios correctly
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
> ### `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**
Contributor guide
Assessment
This issue has not been assessed yet.