From 2f646befb86a627b178567a82ec54a152114207e Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Wed, 9 Dec 2020 16:26:42 +0800 Subject: [PATCH 1/2] Show tenant name --- src/azure-cli-core/azure/cli/core/_profile.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index 3fa252b38a4..4e205954bdb 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -930,8 +930,6 @@ def _find_using_common_tenant(self, access_token, resource): # not available in /tenants?api-version=2016-06-01 if not hasattr(t, 'display_name'): t.display_name = None - if hasattr(t, 'additional_properties'): # Remove this line once SDK is fixed - t.display_name = t.additional_properties.get('displayName') temp_context = self._create_auth_context(tenant_id) try: logger.debug("Acquiring a token with tenant=%s, resource=%s", tenant_id, resource) @@ -975,7 +973,7 @@ def _find_using_common_tenant(self, access_token, resource): "Use 'az login --allow-no-subscriptions' to have tenant level access.") for t in empty_tenants: if t.display_name: - logger.warning("%s '%s'", t.tenant_id, t.display_name) + logger.warning("%s %s", t.tenant_id, t.display_name) else: logger.warning("%s", t.tenant_id) From cf518520e1615211dc73dd682b5ccf2989c0c739 Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Wed, 9 Dec 2020 17:03:43 +0800 Subject: [PATCH 2/2] revert --- src/azure-cli-core/azure/cli/core/_profile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index 4e205954bdb..852a4464748 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -973,7 +973,7 @@ def _find_using_common_tenant(self, access_token, resource): "Use 'az login --allow-no-subscriptions' to have tenant level access.") for t in empty_tenants: if t.display_name: - logger.warning("%s %s", t.tenant_id, t.display_name) + logger.warning("%s '%s'", t.tenant_id, t.display_name) else: logger.warning("%s", t.tenant_id)