azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

"account tenant list" fails with: No module named 'azure.core.rest'

Open pchevallier opened this issue 2 years ago • 7 comments

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az account tenant list Extension Name: account. Version: 0.2.3.

Errors:

The command failed with an unexpected error. Here is the traceback:
No module named 'azure.core.rest'
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.27.0/libexec/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.27.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.27.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.27.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.27.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.27.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 112, in handler
    client = self.client_factory(self.cli_ctx, command_args) if self.client_factory else None
  File "/Users/xxxxxx/.azure/cliextensions/account/azext_account/manual/_client_factory.py", line 20, in cf_tenants
    return cf_account(cli_ctx).tenants
  File "/Users/xxxxxx/.azure/cliextensions/account/azext_account/manual/_client_factory.py", line 9, in cf_account
    from ..vendored_sdks.subscription import SubscriptionClient
  File "/Users/xxxxxx/.azure/cliextensions/account/azext_account/vendored_sdks/subscription/__init__.py", line 9, in <module>
    from ._subscription_client import SubscriptionClient
  File "/Users/xxxxxx/.azure/cliextensions/account/azext_account/vendored_sdks/subscription/_subscription_client.py", line 12, in <module>
    from azure.core.rest import HttpRequest, HttpResponse
ModuleNotFoundError: No module named 'azure.core.rest'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az account tenant list

Expected Behavior

Get the tenants for our account as per https://docs.microsoft.com/en-us/cli/azure/account/tenant?view=azure-cli-latest

Environment Summary

macOS-12.4-x86_64-i386-64bit
Python 3.8.11
Installer: HOMEBREW

azure-cli 2.27.0 *

Extensions:
kusto 0.3.0
azure-iot 0.10.15
azure-devops 0.21.0
account 0.2.3

Additional Context

pchevallier avatar Jul 01 '22 11:07 pchevallier

account

yonzhan avatar Jul 01 '22 11:07 yonzhan

Hi,

We are having similar issues when running an ADF pipeline from azure devops azure cli task:

$runId=az datafactory pipeline create-run --factory-name test-adf --name "pl_load_training_data" --resource-group test-rg --query "runId" --output tsv

results in: image

obiii avatar Sep 06 '22 14:09 obiii

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Sep 06 '22 23:09 ghost

same issue for us.

rbkasat avatar Sep 20 '22 21:09 rbkasat

@pchevallier @obiii @rbkasat This is because the official CLI version you are using is too old and incompatible with the new extension. Could you upgrade the official CLI to the latest version (2.40.0) and try again?

zhoxing-ms avatar Sep 21 '22 02:09 zhoxing-ms

Hi, we were able to fix this by installing the cli via python step: (Having these in our requiremtns.txtx)

azureml

azure-cli-core==2.35.0
azureml-sdk==1.42.0

@pchevallier @obiii @rbkasat This is because the official CLI version you are using is too old and incompatible with the new extension. Could you upgrade the official CLI to the latest version (2.40.0) and try again?

Installing the version 2.40.0 as mentioned by a comment above is not helpful as well.

obiii avatar Sep 21 '22 07:09 obiii

For me, just upgrading azure-cli-core==2.35.0 did the trick

maksteel avatar Oct 11 '22 06:10 maksteel