Azure / Azure/azure-cli

az storage blob list --num-results parameter

Open
#18,379 4 comments 0 reactions 1 assignee Claimed by @Juliehzl View on GitHub
act-codegen-extensibility-squad feature-request Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug
The --num-results parameter is ignored (after a value of 4615)

I encountered a problem on a machine with az version 2.23, locally I had 2.20 installed, where I did not get the MemoryError as seen below, but actually saw that the output returned all ~150 thousand results there are in the blob storage

I then updated my local version to version 2.24.2 and also got the MemoryError

I've used 'binary search' tactic to determine at what value the --num-results parameter was ignored, 4614 returned within a few seconds, but at 4615 it would take a few minutes before throwing the Error below, I don't know if the value 4615 is just relevant for my case

I first tried to put the value on 5000 (as that's the default said in the documentation) but that also returned all entries, that's why I decided to investigate further

**Command Name**
`az storage blob list`

**Errors:**
```
The command failed with an unexpected error. Here is the traceback:

Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 237, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/output.py", line 146, in out
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/output.py", line 37, in format_json
File "json\__init__.py", line 234, in dumps
File "json\encoder.py", line 202, in encode
MemoryError

```

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

- The storage container probably needs a lot of entries
- `az storage blob list --account-name {} --connection-string {} --container-name {} --show-next-marker --num-results 4615 --include m`

## Expected Behavior
It should return 4615 results (or 4616 if the next marker is also returned, which it would in my case)

## Environment Summary
```
Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.24.2

```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.