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

Unable to load extension 'bastion: No module named msrestazure'

Open eliassal opened this issue 4 months ago • 4 comments

Describe the bug

I am trying to run az peering peering list --ResourceGroupG "deve-vnet"

I get C:\Users\s.....azure\cliextensions\azure-devops\azext_devops\dev_init_.py:5: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources Unable to load extension 'bastion: No module named 'msrestazure''. Use --debug for more information.

Related command

az peering peering list

Errors

C:\Users\s.....azure\cliextensions\azure-devops\azext_devops\dev_init_.py:5: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources Unable to load extension 'bastion: No module named 'msrestazure''. Use --debug for more information.

Issue script & Debug output

C:\Users\s.....azure\cliextensions\azure-devops\azext_devops\dev_init_.py:5: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources Unable to load extension 'bastion: No module named 'msrestazure''. Use --debug for more information.

Expected behavior

Get a list of peerings inside a resource group

Environment Summary

azure-cli 2.75.0

core 2.75.0 telemetry 1.1.0

Extensions: account 0.2.5 automation 1.0.0b1 azure-devops 1.0.0 bastion 0.3.0 containerapp 1.1.0b2 interactive 0.5.3 next 0.1.3 resource-graph 2.1.0 spring-cloud 3.1.8 storage-preview 1.0.0b1

Dependencies: msal 1.33.0b1 azure-mgmt-resource 23.3.0

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

Python (Windows) 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

eliassal avatar Jul 29 '25 18:07 eliassal

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

yonzhan avatar Jul 29 '25 18:07 yonzhan

Hi! I had an equal error with an az ssh login...

az ssh vm -n MYHOST -g rg_westeurope_something --port 2022 --subscription MYSUB --prefer-private-ip The command failed with an unexpected error. Here is the traceback: No module named 'msrestazure' ...

I upgraded the SSH extension and then it worked. Maybe you need to upgrade your extensions, too... although I do not know which extension includes the "peering" command. EDIT: Seems to be your "bastion" extension maybe...

I did: az extension remove --name ssh az extension add --name ssh

Cheers and GL!

u023871 avatar Jul 30 '25 08:07 u023871

neither me! I have just installed the peering module which I should think it is the most recent one

eliassal avatar Jul 30 '25 08:07 eliassal

I think the built-in cli extension is broken, and after reinstall the cli extension, it works.

andyzhangx avatar Dec 06 '25 02:12 andyzhangx