Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.58k stars 2.8k forks source link

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

Closed jtamma closed 2 hours ago

jtamma commented 2 hours ago

Describe the bug 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)

To Reproduce Steps to reproduce the behavior:

  1. az extension add --name nexusidentity
  2. az nexusidentity gen-keys

Expected behavior Cli should work with prompting any errors.

Possible Cause Nexusidentity extension installs latest version of azure_identity which relies on AccessTokenInfo from azure.core.credentials. However azure-cli doesn't have the packages installed and expecting the package to be present.

Observation Though the packages are installed in this path '~.azure\cliextensions\nexusidentity, expectation is the packages to be present in this below path 'C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages Manually copying the azure azure_identity azure_core to this C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages resolving the issue

github-actions[bot] commented 2 hours ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

xiangyan99 commented 2 hours ago

Thanks for reaching out.

Please open the issue in https://github.com/Azure/azure-cli repo.