Skip to content

{Profile} Hotfix: az login: fix KeyError: 'displayName'#12824

Merged
jiasli merged 2 commits intoAzure:releasefrom
jiasli:display-name
Apr 1, 2020
Merged

{Profile} Hotfix: az login: fix KeyError: 'displayName'#12824
jiasli merged 2 commits intoAzure:releasefrom
jiasli:display-name

Conversation

@jiasli
Copy link
Member

@jiasli jiasli commented Apr 1, 2020

Description of PR (Mandatory)
Fix #12818: az login fails

The regression is introduced by #12726. display_name is only available since /tenants?api-version=2018-06-01, not available in /tenants?api-version=2016-06-01. We should retrieve display_name from additional_properties with a fallback.

Actually this line shouldn't even be here due to the delay of REST spec fix and SDK release.

Testing Guide

> az cloud update -n AzureCloud --profile 2017-03-09-profile

> az login
The following tenants don't contain accessible subscriptions. Use 'az login --allow-no-subscriptions' to have tenant level access.
ca97aaa0-5a12-4ae3-8929-c8fb57dd93d6

> az cloud update -n AzureCloud --profile latest

> az login
The following tenants don't contain accessible subscriptions. Use 'az login --allow-no-subscriptions' to have tenant level access.
ca97aaa0-5a12-4ae3-8929-c8fb57dd93d6 'mycorp'

@jiasli jiasli linked an issue Apr 1, 2020 that may be closed by this pull request
@yonzhan yonzhan added this to the S168 milestone Apr 1, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 1, 2020

add to S168

Comment on lines +927 to +930
if t.display_name:
logger.warning("%s '%s'", t.tenant_id, t.display_name)
else:
logger.warning("%s", t.tenant_id)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use different formats depending on the presence of t.display_name.

@jiasli jiasli merged commit 40c6098 into Azure:release Apr 1, 2020
@jiasli jiasli deleted the display-name branch April 1, 2020 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az login fails

5 participants