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

Error Encountered with az Key Vault Migration Using Azure CLI on Debian #30740

Closed
jessewright-workflowlabsnet opened this issue Jan 31, 2025 · 4 comments
Assignees
Labels
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. KeyVault az keyvault Possible-Solution 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

@jessewright-workflowlabsnet
Copy link

jessewright-workflowlabsnet commented Jan 31, 2025

This is autogenerated. Please review and update as needed.

Describe the bug

I am using a debian container to do some az keyvault migrations. On my windows machine using az cli this works ok. When I use the apt-get azure-cli package for debian I receive an error. the command is posted below. I am az logged in in my container and az shows help for az keyvault secret.

'az keyvault list' works.
'az keyvault secret' fails also using no other parameters

Command Name
az keyvault secret list --vault-name {my-secret-vault}

Errors:

PS /bin/repos/project> az keyvault secret list --vault-name {my-secret-vault}
The command failed with an unexpected error. Here is the traceback:
No module named 'azure.keyvault.v7_0'
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 561, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 507, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 318, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/lib/python3/dist-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 75, in keyvault_arguments_loader
    op = get_op_handler()
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 72, in get_op_handler
    return self.command_loader.get_op_handler(operations_tmpl.format(method_name))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 884, in get_op_handler
    op = import_module(mod_to_import)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.keyvault.v7_0'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
To open a new issue, please run `az feedback`

To Reproduce:

run this: az keyvault secret list --vault-name {vault-name}
and failure happens

  • Put any pre-requisite steps here...
  • az keyvault secret list --vault-name {}

Expected Behavior

Environment Summary

Linux-6.10.14-linuxkit-x86_64-with-glibc2.36, Debian GNU/Linux 12 (bookworm)
Python 3.11.2
Installer: DEB

azure-cli 2.45.0 *

Extensions:
azure-devops 0.26.0

Dependencies:
msal 1.21.0
azure-mgmt-resource 22.0.0

Additional Context

Copy link

Hi @jessewright-workflowlabsnet,

This is not the official Azure CLI published by Microsoft.

How to tell if the installed Azure CLI is unofficial:

Please follow https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux to install Microsoft official Azure CLI.

If you feel that further discussion is needed, please add a comment with the text /clibot unresolve to reopen the issue.

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 31, 2025

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

Copy link

Here are some similar issues that might help you. Please check if they can solve your problem.


Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)

Solution 1:

The 2.0.81 version of Azure CLI distributed by official Ubuntu repo is not maintained by Microsoft. Please follow https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt to install Azure CLI. It will add Microsoft Linux repo https://packages.microsoft.com/repos/azure-cli/ to apt's source list.

Reference:

Solution 2:

The built-in azure cli is too old to run. Pls upgrade to latest version which is 2.27.0 for now.

Reference:

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot KeyVault az keyvault labels Jan 31, 2025
@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 Jan 31, 2025
@jessewright-workflowlabsnet
Copy link
Author

I found references to this issue after quickly looking into it. There is mention of the azure-cli used by apt-get is not the official Microsoft version.

Im currently trying the recommended approach
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt

@yonzhan yonzhan added this to the Backlog milestone Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. KeyVault az keyvault Possible-Solution 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