{Profile} az login: Handle missing tenantDisplayName#29245
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @jiasli, |
️✔️AzureCLI-BreakingChangeTest
|
|
Profile improvement |
c354227 to
8f59b2c
Compare
tenantDisplayName
tenantDisplayNameaz login: Handle missing tenantDisplayName
|
@jiasli will this fix the same when the subsequent call to /subscriptions is made? Take a look at this:
on the left we see the result from ISE, which just dumps the raw json, on the right we see repro of the issue about failing to handle null. The stack trace shows it's during format of the subscriptions table: File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/profile/custom.py", line 195, in login |
|
looks like it uses that same helper function. Repro above was found on: PS C:\Users\Administrator> az --version core 2.71.0 * Dependencies: Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' Python (Windows) 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:07:15) [MSC v.1942 32 bit (Intel)] |
|
will try with latest release |


Related command
az loginDescription
Fix #29030
HTTP traces in #29030 show that
https://management.azure.com/tenants?api-version=2022-12-01API sometimes don't returndisplayNameproperty. This contradicts the ARM public document https://learn.microsoft.com/en-us/rest/api/resources/tenants/list?view=rest-resources-2022-12-01As
displayNameis defined in the swagger,displayNamewill always exist in the SDK object, but its value isNone, leading tostr+Noneconcatenation error in Azure CLI.This PR handles
NonetenantDisplayNameby falling back totenantId.Testing Guide
Change
azure-cli/src/azure-cli-core/azure/cli/core/_profile.py
Line 874 in 235c355
to
Run
az login.History Notes
[Profile] Fix #29030:
az login: During interactive login, fall back totenantIdiftenantDisplayNameis missing