Skip to content

Failed to run: az storage blob list #28534

@swotiendang

Description

@swotiendang

Describe the bug

I want to purge all file in azure storage container in batch, I used Azure cli to first list out file to be purged, then run purge command, but it failed

Related command

$ContainerName = "invoice"
$StorageConnectionString =
$CutOffDateString = "2022-07-01T00:00:00Z"

az storage blob list --container-name $ContainerName --connection-string $StorageConnectionString --query "[?properties.lastModified < '$CutOffDateString'][name,properties.lastModified]" --output json | Out-File -FilePath "./purging-files.txt"

az storage blob delete-batch --source $ContainerName --connection-string $StorageConnectionString --if-unmodified-since $CutOffDateString --delete-snapshots include

Errors

I cannot provide this log this time, in short, Remote network exception

Issue script & Debug output

DEBUG: cli.knack.cli: init debug log:
Cannot enable color.
DEBUG: cli.knack.cli: Event: Cli.PreExecute []
DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x0000020D0790B880>, <function
OutputProducer.on_global_arguments at 0x0000020D07A96020>, <function CLIQuery.on_global_arguments at 0x0000020D07AC3BA0>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: cli.azure.cli.core: Modules found from index for 'storage': ['azure.cli.command_modules.storage']
DEBUG: cli.azure.cli.core: Loading command modules:
DEBUG: cli.azure.cli.core: Name Load Time Groups Commands
DEBUG: cli.azure.cli.core: storage 0.469 59 273
DEBUG: cli.azure.cli.core: Total (1) 0.469 59 273
DEBUG: cli.azure.cli.core: Loaded 59 groups, 273 commands.
DEBUG: cli.azure.cli.core: Found a match in the command table.
DEBUG: cli.azure.cli.core: Raw command : storage blob list
DEBUG: cli.azure.cli.core: Command table: storage blob list
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x0000020D0A966D40>]
DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to
'C:\Users\roel.ricarte2.azure\commands\2024-03-08.08-06-36.storage_blob_list.7980.log'.
INFO: az_command_data_logger: command args: storage blob list --debug --container-name {} --account-key {} --account-name {} --query {} --output {}
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at
0x0000020D0A973380>]
DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/profiles/_shared.py", line 660, in _get_attr
AttributeError: module 'azure.mgmt.storage.v2023_01_01.models' has no attribute 'ActiveDirectoryPropertiesAccountType'
DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/profiles/_shared.py", line 660, in _get_attr
AttributeError: module 'azure.mgmt.storage.v2023_01_01.models' has no attribute 'ListKeyExpand'
DEBUG: cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/profiles/_shared.py", line 660, in _get_attr
AttributeError: module 'azure.mgmt.storage.v2023_01_01.models' has no attribute 'CorsRuleAllowedMethodsItem'
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x0000020D0A9C1260>, <function
register_cache_arguments..add_cache_arguments at 0x0000020D0A9C13A0>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x0000020D07A960C0>, <function
CLIQuery.handle_query_parameter at 0x0000020D07AC3C40>, <function register_ids_argument..parse_ids_arguments at 0x0000020D0A9C1300>]
INFO: cli.azure.cli.command_modules.storage._validators: Try to get storage auth_mode value from environment variables or config file.
INFO: cli.azure.cli.command_modules.storage._validators: Try to get storage sas_token value from environment variables or config file.
DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): prodseafilestorage.blob.core.windows.net:443
DEBUG: urllib3.connectionpool: https://prodseafilestorage.blob.core.windows.net:443 "GET /invoice?restype=container&comp=list&maxresults=5000 HTTP/1.1" 200 None
WARNING: cli.azure.cli.command_modules.storage.operations.blob: Next Marker:
[3:11 PM] Gupta1, Sachin
WARNING: cli.azure.cli.command_modules.storage.operations.blob: 2!96!MDAwMDI3ITAwMDk0NjAzNThfQk4yMzA5MDM5OTg1LnBkZiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-

DEBUG: cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x0000020D0A99E3E0>, <function

_x509_from_base64_to_hex_transform at 0x0000020D0A99E480>]

DEBUG: cli.knack.cli: Event: CommandInvoker.OnFilterResult [<function CLIQuery.handle_query_parameter..filter_output at 0x0000020D0D1F31A0>]

DEBUG: cli.knack.cli: Event: Cli.SuccessfulExecute []

DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x0000020D0A966FC0>]

INFO: az_command_data_logger: exit code: 0

INFO: cli.main: Command ran in 8.953 seconds (init: 0.665, invoke: 8.287)

INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1

INFO: telemetry.client: Accumulated 0 events. Flush the clients.

INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1

INFO: telemetry.save: Save telemetry record of length 3557 in cache

INFO: telemetry.main: Begin creating telemetry upload process.

INFO: telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft

SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry_init_.pyc C:\Users\roel.ricarte2.azure"

INFO: telemetry.process: Return from creating process

INFO: telemetry.main: Finish creating telemetry upload process.

Expected behavior

az storage blob list should be working and output the file to be purged before actually run

Environment Summary

azure-cli 2.58.0

core 2.58.0
telemetry 1.1.0

Dependencies:
msal 1.26.0
azure-mgmt-resource 23.1.0b2

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

Python (Windows) 3.11.7 (tags/v3.11.7:fa7a6f2, Dec 4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

It's working in my local machine for development storage container, but failed to run in production storage container
The same az version, same script, but only failed in production

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamStorageaz storageact-codegen-extensibility-squadcustomer-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