Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After executing az login and completing the login through the web page, an error is returned in the command line #29241

Closed
m1iktea opened this issue Jun 25, 2024 · 4 comments
Assignees
Labels
Account az login/account Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Similar-Issue
Milestone

Comments

@m1iktea
Copy link

m1iktea commented Jun 25, 2024

Describe the bug

After executing az login and completing the login through the web page, an error is returned in the command line

Related command

root@XKL:~# az login
A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
tcgetpgrp failed: Not a tty

Retrieving tenants and subscriptions for the selection...

The command failed with an unexpected error. Here is the traceback:
can only concatenate str (not "NoneType") to str
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/custom.py", line 175, in login
    selected = SubscriptionSelector(subscriptions)()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 19, in __init__
    self._format_subscription_table()
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 52, in _format_subscription_table
    'Tenant': highlight_text(self._get_tenant_string(sub), is_default)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 31, in highlight_text
    return format_styled_text((Style.HIGHLIGHT, text)) if row_is_default else text
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/style.py", line 201, in format_styled_text
    formatted_parts.append(escape_seq + raw_text)
                           ~~~~~~~~~~~^~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Errors

root@XKL:~# az login
A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
tcgetpgrp failed: Not a tty

Retrieving tenants and subscriptions for the selection...

The command failed with an unexpected error. Here is the traceback:
can only concatenate str (not "NoneType") to str
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/custom.py", line 175, in login
    selected = SubscriptionSelector(subscriptions)()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 19, in __init__
    self._format_subscription_table()
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 52, in _format_subscription_table
    'Tenant': highlight_text(self._get_tenant_string(sub), is_default)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 31, in highlight_text
    return format_styled_text((Style.HIGHLIGHT, text)) if row_is_default else text
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/style.py", line 201, in format_styled_text
    formatted_parts.append(escape_seq + raw_text)
                           ~~~~~~~~~~~^~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Issue script & Debug output

root@XKL:~# az login --debug
cli.knack.cli: Command arguments: ['login', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f3a0e7bc040>, <function OutputProducer.on_global_arguments at 0x7f3a0e766200>, <function CLIQuery.on_global_arguments at 0x7f3a0e7a3ce0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'login': ['azure.cli.command_modules.profile']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: profile                   0.006         2         8
cli.azure.cli.core: Total (1)                 0.006         2         8
cli.azure.cli.core: Loaded 2 groups, 8 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : login
cli.azure.cli.core: Command table: login
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f3a0d83ce00>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/root/.azure/commands/2024-06-25.13-50-50.login.130789.log'.
az_command_data_logger: command args: login --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7f3a0d891ee0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7f3a0d8a9120>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7f3a0d8a9260>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f3a0e7662a0>, <function CLIQuery.handle_query_parameter at 0x7f3a0e7a3d80>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7f3a0d8a91c0>]
cli.azure.cli.core.auth.persistence: build_persistence: location='/root/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /root/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/organizations
msal.authority: openid_config("https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/organizations/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/{tenantid}/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/organizations/kerberos', 'tenant_region_scope': None, 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? None
cli.azure.cli.core.auth.identity: A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
msal.telemetry: Generate or reuse correlation_id: 13f6b5ca-6033-4de4-8e27-c06bf653e433
msal.oauth2cli.oauth2: Using http://localhost:60809 as redirect_uri
msal.oauth2cli.authcode: Abort by visit http://localhost:60809?error=abort
msal.oauth2cli.authcode: Open a browser on this device to visit: https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=04b07795-8ddb-461a-bbee-02f9e1bf7b46&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A60809&scope=https%3A%2F%2Fmanagement.core.windows.net%2F%2F.default+offline_access+openid+profile&state=khvJcQiFtDHRAPGx&code_challenge=9tStnVudEuV3lJBpjZPCxDBoMIAsjf4kCxhRpeRSilU&code_challenge_method=S256&nonce=32424753da80d8ee4612f620cf48001f3cb71759fc5d136b632fc08504114728&client_info=1&claims=%7B%22access_token%22%3A+%7B%22xms_cc%22%3A+%7B%22values%22%3A+%5B%22CP1%22%5D%7D%7D%7D&prompt=select_account
tcgetpgrp failed: Not a tty
msal.oauth2cli.authcode: Got auth response: {'code': '0.ASsAWWkvEpJ02EKM9fkjOsGMT5V3sATbjRpGu-4C-eG_e0bCAKU.AgABBAIAAAApTwJmzXqdR4BN2miheQMYAgDs_wUA9P9EHE1fCYKssdqQ4gh7KRL-2RBNa4lndVi-oQ1sup5DbVNyPzmF_M5fdBYi3OBFT0-QcZ2VbUMQl8Fnhm_yAEC1coW_YGEi4EhO0vRAtg0Q1NejA0kGckaNxhU2nccGbEO2-8ptvFBgFxLehYi-zzVPMdYTv8fzOVK7O0NHx-pSAzVxNc28g-P7Hr19kBrf0wFRd1kGeOovr--ezzpHR0wc5D_tGWY2SqZVxnuCw6rGrblfsWMLIhNJXcYQtqLDIhtIhPz-h6gakeIxmKzSre7Tuw2oErWUkP_SXdnskcsEjIYsPJi5owp9tpYIClxWKaPM3UpsB6K2H1lyUMk0JbtwFZDHY-Ef8aSdI1Ph6V1S3I0BwYE_3ArYENrSDx8zFKvUt_2AKiXn0GD4QGgZMIzDNnytmYweyIBzXNfkIGOy913u92ftt3q7oE5o9fTApljgDkZB8ZSr5Jlfsy3I_8xkWfCqrqcZadMCHfVxSDC5turOrT5G3AI8EAQFf0BG9-jWmcVUJscyDOuFeCXGQu7mAQ5XNu9HccQe80IyUuvlBn6_jDk6M9Esi_HBwtvM0LNmpnwyBWyXGnio8ZH4TooNk1G_UsMROvWGwVmkC65K1_paALYzZYDxeyhRFF5ioNa0ifGOlpSOGZDfsVjI2tXKYRf8pprxYJHeTp4spKdlYPsxjZncgtdWzjHmtMA4pttWW0tNFYRZph1H_tE-_af3Xuq73WaCHw5hEfejxbWkjXZt-YCSWQhFsSskz59vTkmU07rWLt3X1u1C95cliEruSuX-CpYA-7sONHSh-aPMv6ZLPhj0I0WLPEzGOzL4-EX4R4BjPzGMCp-WC53xlqb3DN1T1tbIPs9CzIo5qRKrnLhbi7xVu2_FgdMnRZNkqRHdYMY_DbUxr6AGWbBRYPcEWt3OaGuQWhUqnj_pjP2D2fqfxtJAfIV8bCLYX_4', 'client_info': 'eyJ1aWQiOiJhZDY5YmVlNy1mMGQ3LTQzYzUtOWJhZi1lYjZjMzJjZjc2ZGEiLCJ1dGlkIjoiMTIyZjY5NTktNzQ5Mi00MmQ4LThjZjUtZjkyMzNhYzE4YzRmIn0', 'state': 'khvJcQiFtDHRAPGx', 'session_state': 'e2bc7607-b4d6-4110-b357-3a7148e6404d'}
msal.oauth2cli.authcode: "GET /?code=0.ASsAWWkvEpJ02EKM9fkjOsGMT5V3sATbjRpGu-4C-eG_e0bCAKU.AgABBAIAAAApTwJmzXqdR4BN2miheQMYAgDs_wUA9P9EHE1fCYKssdqQ4gh7KRL-2RBNa4lndVi-oQ1sup5DbVNyPzmF_M5fdBYi3OBFT0-QcZ2VbUMQl8Fnhm_yAEC1coW_YGEi4EhO0vRAtg0Q1NejA0kGckaNxhU2nccGbEO2-8ptvFBgFxLehYi-zzVPMdYTv8fzOVK7O0NHx-pSAzVxNc28g-P7Hr19kBrf0wFRd1kGeOovr--ezzpHR0wc5D_tGWY2SqZVxnuCw6rGrblfsWMLIhNJXcYQtqLDIhtIhPz-h6gakeIxmKzSre7Tuw2oErWUkP_SXdnskcsEjIYsPJi5owp9tpYIClxWKaPM3UpsB6K2H1lyUMk0JbtwFZDHY-Ef8aSdI1Ph6V1S3I0BwYE_3ArYENrSDx8zFKvUt_2AKiXn0GD4QGgZMIzDNnytmYweyIBzXNfkIGOy913u92ftt3q7oE5o9fTApljgDkZB8ZSr5Jlfsy3I_8xkWfCqrqcZadMCHfVxSDC5turOrT5G3AI8EAQFf0BG9-jWmcVUJscyDOuFeCXGQu7mAQ5XNu9HccQe80IyUuvlBn6_jDk6M9Esi_HBwtvM0LNmpnwyBWyXGnio8ZH4TooNk1G_UsMROvWGwVmkC65K1_paALYzZYDxeyhRFF5ioNa0ifGOlpSOGZDfsVjI2tXKYRf8pprxYJHeTp4spKdlYPsxjZncgtdWzjHmtMA4pttWW0tNFYRZph1H_tE-_af3Xuq73WaCHw5hEfejxbWkjXZt-YCSWQhFsSskz59vTkmU07rWLt3X1u1C95cliEruSuX-CpYA-7sONHSh-aPMv6ZLPhj0I0WLPEzGOzL4-EX4R4BjPzGMCp-WC53xlqb3DN1T1tbIPs9CzIo5qRKrnLhbi7xVu2_FgdMnRZNkqRHdYMY_DbUxr6AGWbBRYPcEWt3OaGuQWhUqnj_pjP2D2fqfxtJAfIV8bCLYX_4&client_info=eyJ1aWQiOiJhZDY5YmVlNy1mMGQ3LTQzYzUtOWJhZi1lYjZjMzJjZjc2ZGEiLCJ1dGlkIjoiMTIyZjY5NTktNzQ5Mi00MmQ4LThjZjUtZjkyMzNhYzE4YzRmIn0&state=khvJcQiFtDHRAPGx&session_state=e2bc7607-b4d6-4110-b357-3a7148e6404d HTTP/1.1" 200 -
urllib3.connectionpool: Starting new HTTPS connection (1): login.microsoftonline.com:443
urllib3.connectionpool: https://login.microsoftonline.com:443 "POST /organizations/oauth2/v2.0/token HTTP/1.1" 200 4903
msal.token_cache: event={
    "client_id": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
    "data": {
        "claims": "{\"access_token\": {\"xms_cc\": {\"values\": [\"CP1\"]}}}",
        "client_id": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
        "code": "0.ASsAWWkvEpJ02EKM9fkjOsGMT5V3sATbjRpGu-4C-eG_e0bCAKU.AgABBAIAAAApTwJmzXqdR4BN2miheQMYAgDs_wUA9P9EHE1fCYKssdqQ4gh7KRL-2RBNa4lndVi-oQ1sup5DbVNyPzmF_M5fdBYi3OBFT0-QcZ2VbUMQl8Fnhm_yAEC1coW_YGEi4EhO0vRAtg0Q1NejA0kGckaNxhU2nccGbEO2-8ptvFBgFxLehYi-zzVPMdYTv8fzOVK7O0NHx-pSAzVxNc28g-P7Hr19kBrf0wFRd1kGeOovr--ezzpHR0wc5D_tGWY2SqZVxnuCw6rGrblfsWMLIhNJXcYQtqLDIhtIhPz-h6gakeIxmKzSre7Tuw2oErWUkP_SXdnskcsEjIYsPJi5owp9tpYIClxWKaPM3UpsB6K2H1lyUMk0JbtwFZDHY-Ef8aSdI1Ph6V1S3I0BwYE_3ArYENrSDx8zFKvUt_2AKiXn0GD4QGgZMIzDNnytmYweyIBzXNfkIGOy913u92ftt3q7oE5o9fTApljgDkZB8ZSr5Jlfsy3I_8xkWfCqrqcZadMCHfVxSDC5turOrT5G3AI8EAQFf0BG9-jWmcVUJscyDOuFeCXGQu7mAQ5XNu9HccQe80IyUuvlBn6_jDk6M9Esi_HBwtvM0LNmpnwyBWyXGnio8ZH4TooNk1G_UsMROvWGwVmkC65K1_paALYzZYDxeyhRFF5ioNa0ifGOlpSOGZDfsVjI2tXKYRf8pprxYJHeTp4spKdlYPsxjZncgtdWzjHmtMA4pttWW0tNFYRZph1H_tE-_af3Xuq73WaCHw5hEfejxbWkjXZt-YCSWQhFsSskz59vTkmU07rWLt3X1u1C95cliEruSuX-CpYA-7sONHSh-aPMv6ZLPhj0I0WLPEzGOzL4-EX4R4BjPzGMCp-WC53xlqb3DN1T1tbIPs9CzIo5qRKrnLhbi7xVu2_FgdMnRZNkqRHdYMY_DbUxr6AGWbBRYPcEWt3OaGuQWhUqnj_pjP2D2fqfxtJAfIV8bCLYX_4",
        "code_verifier": "NHDfoxSXM2FmC8ZI6d-VARtnKi1OqY0yujJGrP5Qzlg",
        "redirect_uri": "http://localhost:60809",
        "scope": [
            "offline_access",
            "profile",
            "openid",
            "https://management.core.windows.net//.default"
        ]
    },
    "environment": "login.microsoftonline.com",
    "grant_type": "authorization_code",
    "params": null,
    "response": {
        "access_token": "********",
        "client_info": "eyJ1aWQiOiJhZDY5YmVlNy1mMGQ3LTQzYzUtOWJhZi1lYjZjMzJjZjc2ZGEiLCJ1dGlkIjoiMTIyZjY5NTktNzQ5Mi00MmQ4LThjZjUtZjkyMzNhYzE4YzRmIn0",
        "expires_in": 5040,
        "ext_expires_in": 5040,
        "foci": "1",
        "id_token": "********",
        "refresh_token": "********",
        "scope": "https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default",
        "token_type": "Bearer"
    },
    "scope": [
        "https://management.core.windows.net//user_impersonation",
        "https://management.core.windows.net//.default"
    ],
    "token_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/token"
}

Retrieving tenants and subscriptions for the selection...
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/organizations
msal.authority: openid_config("https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/organizations/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/{tenantid}/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/organizations/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/organizations/kerberos', 'tenant_region_scope': None, 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? None
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: e99562b0-393c-4435-8e31-3838ccbe70f0
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/tenants?api-version=2022-12-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': 'e09e5f25-32b6-11ef-8850-5def8b4d7a14'
cli.azure.cli.core.sdk.policies:     'CommandName': 'login'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.61.0 (DEB) azsdk-python-core/1.28.0 Python/3.11.8 (Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /tenants?api-version=2022-12-01 HTTP/1.1" 200 140
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Content-Length': '140'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-tenant-reads': '249'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': '96b5d7a6-6fc6-4bc2-960a-e3b2de3f6abe'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': '96b5d7a6-6fc6-4bc2-960a-e3b2de3f6abe'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'SWITZERLANDNORTH:20240625T055107Z:96b5d7a6-6fc6-4bc2-960a-e3b2de3f6abe'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.sdk.policies:     'X-MSEdge-Ref': 'Ref A: 898E80575D864096B235460287B7B16B Ref B: FRA231050416037 Ref C: 2024-06-25T05:51:07Z'
cli.azure.cli.core.sdk.policies:     'Date': 'Tue, 25 Jun 2024 05:51:06 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"value":[{"id":"/tenants/122f6959-7492-42d8-8cf5-f9233ac18c4f","tenantId":"122f6959-7492-42d8-8cf5-f9233ac18c4f","tenantCategory":"Home"}]}
cli.azure.cli.core._profile: Finding subscriptions under tenant 122f6959-7492-42d8-8cf5-f9233ac18c4f
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/122f6959-7492-42d8-8cf5-f9233ac18c4f
msal.authority: openid_config("https://login.microsoftonline.com/122f6959-7492-42d8-8cf5-f9233ac18c4f/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/122f6959-7492-42d8-8cf5-f9233ac18c4f/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/122f6959-7492-42d8-8cf5-f9233ac18c4f/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/122f6959-7492-42d8-8cf5-f9233ac18c4f/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/122f6959-7492-42d8-8cf5-f9233ac18c4f/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/122f6959-7492-42d8-8cf5-f9233ac18c4f/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/122f6959-7492-42d8-8cf5-f9233ac18c4f/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/122f6959-7492-42d8-8cf5-f9233ac18c4f/kerberos', 'tenant_region_scope': 'AS', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? None
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: e879c39a-4983-433d-9e58-7ef44c00cbf5
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions?api-version=2022-12-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': 'e09e5f25-32b6-11ef-8850-5def8b4d7a14'
cli.azure.cli.core.sdk.policies:     'CommandName': 'login'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.61.0 (DEB) azsdk-python-core/1.28.0 Python/3.11.8 (Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions?api-version=2022-12-01 HTTP/1.1" 200 453
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Content-Length': '453'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-tenant-reads': '249'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': '0fdd167c-93d2-4d0f-9d44-b104bfe90fdd'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': '0fdd167c-93d2-4d0f-9d44-b104bfe90fdd'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'GERMANYWESTCENTRAL:20240625T055109Z:0fdd167c-93d2-4d0f-9d44-b104bfe90fdd'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.sdk.policies:     'X-MSEdge-Ref': 'Ref A: 06BEC62BC7314BF98253253927A03A3D Ref B: FRA231050411039 Ref C: 2024-06-25T05:51:08Z'
cli.azure.cli.core.sdk.policies:     'Date': 'Tue, 25 Jun 2024 05:51:08 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"value":[{"id":"/subscriptions/b32b2614-43cf-4d62-a4ca-de9240875312","authorizationSource":"RoleBased","managedByTenants":[],"subscriptionId":"b32b2614-43cf-4d62-a4ca-de9240875312","tenantId":"122f6959-7492-42d8-8cf5-f9233ac18c4f","displayName":"Microsoft Azure Sponsorship","state":"Enabled","subscriptionPolicies":{"locationPlacementId":"Public_2014-09-01","quotaId":"Sponsored_2016-01-01","spendingLimit":"Off"}}],"count":{"type":"Total","value":1}}
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/custom.py", line 175, in login
    selected = SubscriptionSelector(subscriptions)()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 19, in __init__
    self._format_subscription_table()
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 52, in _format_subscription_table
    'Tenant': highlight_text(self._get_tenant_string(sub), is_default)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 31, in highlight_text
    return format_styled_text((Style.HIGHLIGHT, text)) if row_is_default else text
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/style.py", line 201, in format_styled_text
    formatted_parts.append(escape_seq + raw_text)
                           ~~~~~~~~~~~^~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: can only concatenate str (not "NoneType") to str
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/custom.py", line 175, in login
    selected = SubscriptionSelector(subscriptions)()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 19, in __init__
    self._format_subscription_table()
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 52, in _format_subscription_table
    'Tenant': highlight_text(self._get_tenant_string(sub), is_default)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 31, in highlight_text
    return format_styled_text((Style.HIGHLIGHT, text)) if row_is_default else text
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/style.py", line 201, in format_styled_text
    formatted_parts.append(escape_seq + raw_text)
                           ~~~~~~~~~~~^~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str
az_command_data_logger: can only concatenate str (not "NoneType") to str
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/custom.py", line 175, in login
    selected = SubscriptionSelector(subscriptions)()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 19, in __init__
    self._format_subscription_table()
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 52, in _format_subscription_table
    'Tenant': highlight_text(self._get_tenant_string(sub), is_default)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 31, in highlight_text
    return format_styled_text((Style.HIGHLIGHT, text)) if row_is_default else text
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/style.py", line 201, in format_styled_text
    formatted_parts.append(escape_seq + raw_text)
                           ~~~~~~~~~~~^~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f3a0d83d080>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 19.842 seconds (init: 0.340, invoke: 19.501)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 7836 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /root/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

After a successful login on the web page, there are no errors reported in the command line.

Environment Summary

root@XKL:~# az --version
azure-cli                         2.61.0

core                              2.61.0
telemetry                          1.1.0

Dependencies:
msal                              1.28.0
azure-mgmt-resource               23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.11.8 (main, May 16 2024, 03:47:41) [GCC 9.4.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

No response

@m1iktea m1iktea added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jun 25, 2024
Copy link

Hi @m1iktea
Find similar issue #16946.

Issue title A stacktrace with a disorienting message is shown for az apim api import
Create time 2021-02-16
Comment number 3

Please confirm if this resolves your issue.

@microsoft-github-policy-service microsoft-github-policy-service bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Jun 25, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Auto-Assign Auto assign by bot Account az login/account labels Jun 25, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 25, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 25, 2024
@yonzhan yonzhan added this to the Backlog milestone Jun 25, 2024
@yonzhan yonzhan removed the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jun 25, 2024
@jiasli
Copy link
Member

jiasli commented Jun 25, 2024

Duplicate of #29030

@jiasli jiasli marked this as a duplicate of #29030 Jun 25, 2024
@jiasli jiasli closed this as completed Jun 25, 2024
@m1iktea
Copy link
Author

m1iktea commented Jun 25, 2024

az config set core.login_experience_v2=off
az account clear
az config set core.enable_broker_on_windows=false

then try login

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Similar-Issue
Projects
None yet
Development

No branches or pull requests

3 participants