question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

az storage blob upload can overwrite a blob without needing the --overwrite parameter in az cli version 2.33.1 , however in version 2.34.1 it requires the overwrite parameter.

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az storage blob upload

Detailed command

az storage blob upload --account-name <my-storage-account> --container-name '$web' --file <my-file> --auth-mode login Errors:

The specified blob already exists.
RequestId:xxxx-xxxxx-xxxx
Time:2022-03-24T04:01:57.5064729Z
ErrorCode:BlobAlreadyExists
If you want to overwrite the existing one, please add --overwrite in your command.

To Reproduce:

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

  • Install the latest azure cli on your workstation - As of raising this bug this is v2.34.1
  • Attempt to overwrite an existing blob in a container
  • az storage blob upload --account-name <my-storage-account> --container-name ‘$web’ --file <my-file> --auth-mode login
  • You will get the error The specified blob already exists
  • Now install the version v2.33.1 of azure cli and try the same steps as above
  • The file can be re-uploaded/overwritten again and again without any error.
  • So in summary:
    • If you have azure cli v2.33.1 - az storage blob upload allows the upload of the same file to the same location allowing it to be overwritten.
    • if you have azure cli v2.34.1 - az storage blob upload doesn’t allow the upload of the same file to the same location, instead throws an error Blob already exists and requires the experimental parameter --overwrite to be supplied.

Expected Behavior

  • I don’t expect this breaking change to be introduced. Azure CLI tasks ( for azure pipelines ) is using azure CLI v2.33.1 and the file upload works smoothly, but I am afraid as soon as the Azure CLI task gets upgraded to v2.34.1 my pipeline code will break.

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.34.1

Extensions:
azure-devops 0.22.0
desktopvirtualization 0.1.1
interactive 0.4.5
log-analytics 0.2.2
next 0.1.2
rdbms-connect 1.0.1

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0

Additional Context

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:6
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
norb62commented, Apr 21, 2022

This change breaks every piece of 3rd party code using upload or upload-batch as soon as the az client is updated to 2.34.1 or higher. To workaround this, I need to manually detect the az version, then issue 2 different commands, depending on the version, since the --overwrite option does not exist in az storage upload before 2.34.1. It’s not optimal imo.

–overwrite should be true by default and when not specified, to ensure backward compatibility. If a user wants to ensure that its data can’t be overwritten, it could specify --overwrite false.

2reactions
calvinhzycommented, Mar 24, 2022

We have included this as a breaking change in 2.34.1 as we think it is dangerous to overwrite files silently. --overwrite needs to be specified to overwrite files. Sorry for the inconvenience. https://docs.microsoft.com/en-us/cli/azure/storage/blob?view=azure-cli-latest#az-storage-blob-upload

Read more comments on GitHub >

github_iconTop Results From Across the Web

az storage blob | Microsoft Learn
Manage object storage for unstructured data (blobs). Please specify one of the following authentication parameters for your commands: --auth-mode, ...
Read more >
Deploying a Static Site to Azure Using the az CLI
This post is about deploying a static sites to Azure storage account using Azure CLI and configuring GitHub actions to deploy the files....
Read more >
azure-cli-storage 2.4.3 - PyPI
BREAKING CHANGE: storage account show-usage now requires –location parameter and will list by region. Make '–resource-group' parameter optional for 'storage ...
Read more >
Azure CLI Command for Deleting all the files in Blob storage ...
I configured my release pipeline to clear all files before uploading the new flies using az copy. IP=`curl -s http://ipinfo.io/json | jq -r...
Read more >
Azure Storage Blob Sync - Updates to AzCopy and Azure CLI
Everything that is new or changed in a source folder should be uploaded to a target blob storage - and - optionally, files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found