az storage blob sync's deletion behavior can lead to unexpected data loss #21414
Labels
Auto-Assign
Auto assign by bot
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Storage
az storage
Milestone
Is your feature request related to a problem? Please describe.
Currently, the
az storage blob sync
command will delete blobs at the destination that are not present in the source. This is hardcoded into the command, with no documentation of its behavior or an option to change it. Additionally, this is inconsistent with the default behavior of other prominent tools for Azure as well as other cloud providers' storage services, includingazcopy
, which include a flag to enable deleting but do not do so by default.In fact, this command is implemented in
azure-cli
by wrappingazcopy sync
but then overridingazcopy
's default. Relevant source code:azure-cli/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py
Lines 84 to 87 in 92c50bc
This is a risky design that can lead to unexpected deletion by users and result in data loss. (This happened to me.)
Describe the solution you'd like
--delete-destination
to match the functionality ofazcopy sync
.The text was updated successfully, but these errors were encountered: