The command failed with an unexpected error. Here is the traceback

When trying to run an az command against keyvault secrets i am presented with:

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 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 528, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 299, 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 291, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/lib/python3/dist-packages/knack/commands.py", line 97, in load_arguments
    cmd_args = self.arguments_loader()
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 71, in keyvault_arguments_loader
    op = get_op_handler()
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 68, 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 536, in get_op_handler
    op = import_module(mod_to_import)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.keyvault.v7_0'

Answer

for me, the version of ubuntu i was using - 20.04 - required a specific version of azure.keyvault:

so i installed it:

pip3 install azure-keyvault==1.1.0

source