Skip to content

az storage blob sync's deletion behavior can lead to unexpected data loss #21414

@jayqi

Description

@jayqi

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:

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

  1. Add a --delete-destination to match the functionality of azcopy sync.
  2. Have that flag default to false.

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botStorageaz storagecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions