Failed to run: az storage blob list
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### 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 [, , ]
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 []
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 [.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 [.add_ids_arguments at 0x0000020D0A9C1260>, .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 [, , .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 [, ]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnFilterResult [.filter_output at 0x0000020D0D1F31A0>]
DEBUG: cli.knack.cli: Event: Cli.SuccessfulExecute []
DEBUG: cli.knack.cli: Event: Cli.PostExecute []
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
Contributor guide
Assessment
This issue has not been assessed yet.