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

ImportError: cannot import name 'AccessTokenInfo' from 'azure.core.credentials' #30120

Closed
jtamma opened this issue Oct 17, 2024 · 2 comments
Closed
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team.

Comments

@jtamma
Copy link

jtamma commented Oct 17, 2024

Describe the bug

Package Name: nexusidentity
Package Version: 1.0.0b1
Operating System: windows
Python Version: 3.11

When running the "az nexusidentity gen-keys" cli, I am running into the below error.

az nexusidentity gen-keys
The command failed with an unexpected error. Here is the traceback: cannot import name 'AccessTokenInfo' from 'azure.core.credentials' (C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\core\credentials.pyc)

Related command

az nexusidentity gen-keys

Errors

The command failed with an unexpected error. Here is the traceback: cannot import name 'AccessTokenInfo' from 'azure.core.credentials' (C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\core\credentials.pyc)

Issue script & Debug output

az nexusidentity gen-keys --debug
cli.knack.cli: Command arguments: ['nexusidentity', 'gen-keys', '--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 0x0000029D26CCFD80>, <function OutputProducer.on_global_arguments at 0x0000029D26E740E0>, <function CLIQuery.on_global_arguments at 0x0000029D26E9DC60>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'nexusidentity': ['azext_nexusidentity']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: nexusidentity 0.014 1 1 C:\Users\user-name.azure\cliextensions\nexusidentity
cli.azure.cli.core: Total (1) 0.014 1 1
cli.azure.cli.core: Loaded 1 groups, 1 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : nexusidentity gen-keys
cli.azure.cli.core: Command table: nexusidentity gen-keys
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x0000029D290D40E0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\user-name.azure\commands\2024-10-15.15-43-33.nexusidentity_gen-keys.6632.log'.
az_command_data_logger: command args: nexusidentity gen-keys --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x0000029D29106A20>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x0000029D29184AE0>, <function register_cache_arguments..add_cache_arguments at 0x0000029D29184C20>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x0000029D29184CC0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x0000029D26E74180>, <function CLIQuery.handle_query_parameter at 0x0000029D26E9DD00>, <function register_ids_argument..parse_ids_arguments at 0x0000029D29184B80>]
az_command_data_logger: extension name: nexusidentity
az_command_data_logger: extension version: 1.0.0b1
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 733, in _run_jobs_serially
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 703, in run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 336, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "C:\Users.azure\cliextensions\nexusidentity\azext_nexusidentity\custom.py", line 23, in generate_nexus_identity_keys
from azure.identity import AzureCliCredential
File "C:\Users.azure\cliextensions\nexusidentity\azure\identity_init.py", line 10, in
from .credentials import (
File "C:\Users.azure\cliextensions\nexusidentity\azure\identity_credentials_init.py", line 5, in
from .authorization_code import AuthorizationCodeCredential
File "C:\Users.azure\cliextensions\nexusidentity\azure\identity_credentials\authorization_code.py", line 7, in
from azure.core.credentials import AccessToken, AccessTokenInfo, TokenRequestOptions
ImportError: cannot import name 'AccessTokenInfo' from 'azure.core.credentials' (C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\core\credentials.pyc)

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: cannot import name 'AccessTokenInfo' from 'azure.core.credentials' (C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\core\credentials.pyc)
Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 733, in _run_jobs_serially
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 703, in run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 336, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "C:\Users.azure\cliextensions\nexusidentity\azext_nexusidentity\custom.py", line 23, in generate_nexus_identity_keys
from azure.identity import AzureCliCredential
File "C:\Users\user-name.azure\cliextensions\nexusidentity\azure\identity_init.py", line 10, in
from .credentials import (
File "C:\Users\user-name.azure\cliextensions\nexusidentity\azure\identity_credentials_init.py", line 5, in
from .authorization_code import AuthorizationCodeCredential
File "C:\Users\user-name.azure\cliextensions\nexusidentity\azure\identity_credentials\authorization_code.py", line 7, in
from azure.core.credentials import AccessToken, AccessTokenInfo, TokenRequestOptions
ImportError: cannot import name 'AccessTokenInfo' from 'azure.core.credentials' (C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\core\credentials.pyc)
az_command_data_logger: cannot import name 'AccessTokenInfo' from 'azure.core.credentials' (C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\core\credentials.pyc)
Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 733, in run_jobs_serially
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 703, in run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 336, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "C:\Users\user-name.azure\cliextensions\nexusidentity\azext_nexusidentity\custom.py", line 23, in generate_nexus_identity_keys
from azure.identity import AzureCliCredential
File "C:\Users\user-name.azure\cliextensions\nexusidentity\azure\identity_init.py", line 10, in
from .credentials import (
File "C:\Users\user-name.azure\cliextensions\nexusidentity\azure\identity_credentials_init.py", line 5, in
from .authorization_code import AuthorizationCodeCredential
File "C:\Users\user-name.azure\cliextensions\nexusidentity\azure\identity_credentials\authorization_code.py", line 7, in
from azure.core.credentials import AccessToken, AccessTokenInfo, TokenRequestOptions
ImportError: cannot import name 'AccessTokenInfo' from 'azure.core.credentials' (C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\core\credentials.pyc)
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 0x0000029D290D4360>]
az_command_data_logger: exit code: 1
cli.main: Command ran in 1.649 seconds (init: 0.599, invoke: 1.050)
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 7877 in cache file under C:\Users\user-name.azure\telemetry\20241015154334896
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry_init.pyc C:\Users\user-name.azure C:\Users\user-name.azure\telemetry\20241015154334896"
telemetry.process: Return from creating process 5604
telemetry.main: Finish creating telemetry upload process.

Expected behavior

PS C:\Users\jtamma> az nexusidentity gen-keys
Generating public/private ed25519-sk key pair.

Environment Summary

azure-cli 2.65.0

core 2.65.0
telemetry 1.1.0

Extensions:
managednetworkfabric 6.2.0
nexusidentity 1.0.0b1

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\jtamma.azure\cliextensions'

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

@jtamma jtamma added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Oct 17, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Oct 17, 2024

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

@yonzhan yonzhan added the Service Attention This issue is responsible by Azure service team. label Oct 18, 2024
@bebound
Copy link
Contributor

bebound commented Oct 30, 2024

Duplicate of #29940

Fixed in latest nexusidentity: Azure/azure-cli-extensions#8165

@bebound bebound marked this as a duplicate of #29940 Oct 30, 2024
@bebound bebound closed this as completed Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants