Search code examples
azureazure-blob-storageazure-sdk-python

Azure: Unable to copy Archive blobs from one storage account to another?


Whenever I try to copy Archive blobs to a different storage account and changing its tier in destination. I am getting the following error:

Copy source blob has been modified. ErrorCode: CannotVerifyCopySource

I have tried copying Hot/Cool blobs to Hot/Cool/Archive. I am facing the issue only while copying Archive to Hot/Cool/Archive. Also, there is no issue while copying within same storage account.

I am using Azure python SDK:

blob_url = source_block_blob_service.make_blob_url(copy_from_container, blob_name, sas_token = sas)

dest_blob_service.copy_blob(copy_to_container, blob_name, blob_url, requires_sync = True, standard_blob_tier = 'Hot')

Solution

  • The reason you're getting this error is because copying an archived blob is only supported in the same storage account and you're trying it across different storage account.

    From the REST API documentation page:

    Copying Archived Blob (version 2018-11-09 and newer)

    An archived blob can be copied to a new blob within the same storage account. This will still leave the initially archived blob as is. When copying an archived blob as source the request must contain the header x-ms-access-tier indicating the tier of the destination blob. The data will be eventually copied to the destination blob.