Azure / Azure/azure-cli

az storage blob delete-batch --if-unmodified-since - Shows 412 Errors

Open
#16,881 11 comments 2 reactions 1 assignee Assigned to @evelyn-ys View on GitHub
act-codegen-extensibility-squad Service Attention Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Describe the bug**
Using `az storage blob delete-batch -s --account-name --if-unmodified-since "2021-02-08T10:45Z"` will log a 412 error for each blob that does not meet the precondition. Is there a way to suppress these errors? It seems that this is not an error, and it will still delete the blobs that do meet the precondition.

**To Reproduce**
- Upload some blobs to storage account
- ```
date=`date -d "" '+%Y-%m-%dT%H:%MZ'`
az storage blob delete-batch -s $(blob-container-name) --account-name $(storage-account-name) --pattern $(blob-prefix-path)/* --if-unmodified-since $date
```
- 412 Errors if unmodified since precondition is not met

**Expected behavior**

- Errors are not raised if precondition is not met (expected that some blobs will not meet the precondition, but do not want to see those errors)

**Environment summary**
- AzureDevops inline bash script

**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.