Skip to content

storageAccount: AZ Cli returning Error while Powershell works #29934

@jhr1972

Description

@jhr1972

Describe the bug

Hi, I am trying to use a simple query that keeps bombing out:

az storage share list --account-name XXXXXX --debug

returning the following error:

cli.azure.cli.core.profiles._shared: Traceback (most recent call last):

File "/usr/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 656, in _get_attr

op = import_module(full_mod_path)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib64/python3.12/importlib/__init__.py", line 90, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

` File "

When querying via Powershell things work fine:

Get-AzRmStorageShare -ResourceGroupName YYYYY -StorageAccountName XXXXX

Please note, the same error occurs also in the cloud shell, so I doubt this issue is specific to my environment.
To replicate the issue the storageAccount needs to have public access disabled.

Related command

az storage share list --account-name XXXXXX --debug

resp.

Get-AzRmStorageShare -ResourceGroupName YYYYY -StorageAccountName XXXXX

Errors

az storage share list --account-name XXXXXX --debug

returning the following error:

cli.azure.cli.core.profiles._shared: Traceback (most recent call last):

File "/usr/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 656, in _get_attr

op = import_module(full_mod_path)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib64/python3.12/importlib/__init__.py", line 90, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

### Issue script & Debug output

To replicate the issue, setup a private stroageAccount and try listing the shares within.
More details are also provided here: https://learn.microsoft.com/en-us/answers/questions/2072016/az-cli-returning-error-while-powershell-works


### Expected behavior

I ran into error via Terraform (relying on the same python modules) which is incapable to create a share as it seems to query for existing shares first.

### Environment Summary

az --version
azure-cli                         2.64.0

core                              2.64.0
telemetry                          1.1.0

Extensions:
ai-examples                        0.2.5
ml                                2.29.0
ssh                                2.0.5

Dependencies:
msal                              1.30.0
azure-mgmt-resource               23.1.1

Python location '/usr/bin/python3.9'
Extensions directory '/home/xxx/.azure/cliextensions'
Extensions system directory '/usr/lib/python3.9/site-packages/azure-cli-extensions'

Python (Linux) 3.9.19 (main, Aug 23 2024, 00:07:48) 
[GCC 11.2.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

### Additional context

To replicate the issue the storageAccount needs to have public access disabled. 

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamOKR CandidateThis label is used to track how many GitHub issues we have resolved for OKR purpose.Storageaz storagecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions