Package: azure-cli
Version: 2.62.0-1
Severity: important

Dear Maintainer,

After running 'az login', trying to run 'az ad signed-in-user show'
produces the following error:

ERROR: User '<email>' does not exist in MSAL token cache. Run `az login`.

However, I am logged in according to 'az account show'.

Full debug output:

DEBUG: cli.knack.cli: Command arguments: ['ad', 'signed-in-user', 'show', 
'--debug']
DEBUG: cli.knack.cli: __init__ debug log:
Cannot enable color.
DEBUG: cli.knack.cli: Event: Cli.PreExecute []
DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function 
CLILogging.on_global_arguments at 0x7fee58663920>, <function 
OutputProducer.on_global_arguments at 0x7fee583b4720>, <function 
CLIQuery.on_global_arguments at 0x7fee583ddd00>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: cli.azure.cli.core: Modules found from index for 'ad': 
['azure.cli.command_modules.role']
DEBUG: cli.azure.cli.core: Loading command modules:
DEBUG: cli.azure.cli.core: Name                  Load Time    Groups  Commands
DEBUG: cli.azure.cli.core: role                      0.004        17        61
DEBUG: cli.azure.cli.core: Total (1)                 0.004        17        61
DEBUG: cli.azure.cli.core: These extensions are not installed and will be 
skipped: ['azext_ai_examples', 'azext_next']
DEBUG: cli.azure.cli.core: Loading extensions:
DEBUG: cli.azure.cli.core: Name                  Load Time    Groups  Commands  
Directory
DEBUG: cli.azure.cli.core: Total (0)                 0.000         0         0
DEBUG: cli.azure.cli.core: Loaded 17 groups, 61 commands.
DEBUG: cli.azure.cli.core: Found a match in the command table.
DEBUG: cli.azure.cli.core: Raw command  : ad signed-in-user show
DEBUG: cli.azure.cli.core: Command table: ad signed-in-user show
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate 
[<function AzCliLogging.init_command_file_logging at 0x7fee57345260>]
DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing 
logs to 
'/home/kyle/.azure/commands/2024-07-25.13-50-36.ad_signed-in-user_show.100176.log'.
INFO: az_command_data_logger: command args: ad signed-in-user show --debug
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function 
register_global_subscription_argument.<locals>.add_subscription_parameter at 
0x7fee5738e340>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function 
register_ids_argument.<locals>.add_ids_arguments at 0x7fee57158540>, <function 
register_cache_arguments.<locals>.add_cache_arguments at 0x7fee57158680>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function 
OutputProducer.handle_output_argument at 0x7fee583b47c0>, <function 
CLIQuery.handle_query_parameter at 0x7fee583ddda0>, <function 
register_ids_argument.<locals>.parse_ids_arguments at 0x7fee571585e0>]
DEBUG: cli.azure.cli.core.util: Retrieving token for resource 
https://graph.microsoft.com/
DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: 
location='/home/kyle/.azure/msal_token_cache.json', encrypt=False
DEBUG: cli.azure.cli.core.auth.binary_cache: load: 
/home/kyle/.azure/msal_http_cache.bin
DEBUG: urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, 
connect=None, read=None, redirect=None, status=None)
DEBUG: msal.authority: Initializing with Entra authority: 
https://login.microsoftonline.com/<tenant-id>
DEBUG: msal.authority: 
openid_config("https://login.microsoftonline.com/<tenant-id>/v2.0/.well-known/openid-configuration")
 = {'token_endpoint': 
'https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token', 
'token_endpoint_auth_methods_supported': ['client_secret_post', 
'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 
'https://login.microsoftonline.com/<tenant-id>/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/<tenant-id>/v2.0', 
'request_uri_parameter_supported': False, 'userinfo_endpoint': 
'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 
'https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize', 
'device_authorization_endpoint': 
'https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/devicecode', 
'http_logout_supported': True, 'frontchannel_logout_supported': True, 
'end_session_endpoint': 
'https://login.microsoftonline.com/<tenant-id>/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/<tenant-id>/kerberos', 
'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 
'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 
'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
DEBUG: msal.application: Broker enabled? None
DEBUG: msal.application: get_accounts(username='<user>@<email>') finds no 
account. If tokens were acquired without 'profile' scope, they would contain no 
username for filtering. Consider calling get_accounts(username=None) instead.
DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", 
line 664, in execute
    raise ex
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", 
line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", 
line 723, in _run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/azure/cli/command_modules/role/commands.py", 
line 51, in graph_err_handler
    raise ex
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", 
line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", 
line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", 
line 363, in handler
    show_exception_handler(ex)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/arm.py", line 
432, in show_exception_handler
    raise ex
  File 
"/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", 
line 361, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/azure/cli/command_modules/role/custom.py", line 
1821, in show_signed_in_user
    result = client.signed_in_user_get()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/azure/cli/command_modules/role/_msgrpah/_graph_client.py",
 line 224, in signed_in_user_get
    result = self._send("GET", "/me")
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/azure/cli/command_modules/role/_msgrpah/_graph_client.py",
 line 52, in _send
    r = send_raw_request(self._cli_ctx, method, url, resource=self._resource, 
uri_parameters=param,
        
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 983, in 
send_raw_request
    token_info, _, _ = profile.get_raw_token(resource)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 405, 
in get_raw_token
    credential = self._create_credential(account, tenant)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 615, 
in _create_credential
    return identity.get_user_credential(username_or_sp_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/core/auth/identity.py", line 
235, in get_user_credential
    return UserCredential(self.client_id, username, 
**self._msal_public_app_kwargs)
           
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/azure/cli/core/auth/msal_authentication.py", 
line 58, in __init__
    raise CLIError("User '{}' does not exist in MSAL token cache. Run `az 
login`.".format(username))
knack.util.CLIError: User '<user>@<email>' does not exist in MSAL token cache. 
Run `az login`.

ERROR: cli.azure.cli.core.azclierror: User '<user>@<email>' does not exist in 
MSAL token cache. Run `az login`.
ERROR: az_command_data_logger: User '<user>@<email>' does not exist in MSAL 
token cache. Run `az login`.
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function 
AzCliLogging.deinit_cmd_metadata_logging at 0x7fee573454e0>]
INFO: az_command_data_logger: exit code: 1
INFO: cli.azure.cli.__main__: Command ran in 0.630 seconds (init: 0.192, 
invoke: 0.438)
INFO: telemetry.main: Begin splitting cli events and extra events, total 
events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 
1
INFO: telemetry.save: Save telemetry record of length 3891 in cache
INFO: telemetry.main: Begin creating telemetry upload process.
INFO: telemetry.process: Creating upload process: "/usr/bin/python3 
/usr/lib/python3/dist-packages/azure/cli/telemetry/__init__.py 
/home/kyle/.azure"
INFO: telemetry.process: Return from creating process
INFO: telemetry.main: Finish creating telemetry upload process.


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.9.10-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_ZA.UTF-8, LC_CTYPE=en_ZA.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_ZA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages azure-cli depends on:
ii  python3            3.12.3-1
ii  python3-azure-cli  2.62.0-1

azure-cli recommends no packages.

azure-cli suggests no packages.

-- no debconf information

Reply via email to