Azure / Azure/azure-cli

delete-batch ignores --query option

Open
#21,568 1 comment 0 reactions 1 assignee Claimed by @evelyn-ys View on GitHub
act-codegen-extensibility-squad Auto-Assign customer-reported Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug
According to documentation delete-batch --query is supported as part of Global parameter https://docs.microsoft.com/en-us/cli/azure/storage/blob?view=azure-cli-latest#az-storage-blob-delete-batch

**Command Name**
`az storage blob list`
`az storage delete-batch`

**Errors:**

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

- `az storage blob list --include m --prefix "myBlobPrefix*" --output table --num-results "*" --query "[?metadata.myKey=='myVal']"`
- `az storage delete-batch --dry-run --pattern "myBlobPrefix*" --query "[?metadata.myKey=='myVal']"`

## Expected Behavior
az storage delete-batch --dry-run --query should only show file that match the "--query"

## Environment Summary
```
Linux-5.4.0-54-generic-x86_64-with-debian-bullseye-sid
Python 3.6.10
Installer: DEB

azure-cli 2.8.0

```
## Additional Context
This is related to this https://github.com/Azure/azure-cli/issues/15734 though OP asked for delete-batch, answer was for download-batch but I assume its a mistype.
Basically we want to delete-batch a blob that match the query, in my case a metadata.

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.