-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
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, including azcopy, which include a flag to enable deleting but do not do so by default.
In fact, this command is implemented in azure-cli by wrapping azcopy sync but then overriding azcopy's default. Relevant source code:
azure-cli/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py
Lines 84 to 87 in 92c50bc
| def storage_blob_sync(cmd, client, source, destination, exclude_pattern=None, include_pattern=None, | |
| exclude_path=None): | |
| azcopy = _azcopy_blob_client(cmd, client) | |
| flags = ['--delete-destination=true'] |
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
- Add a
--delete-destinationto match the functionality ofazcopy sync. - Have that flag default to false.