I'm trying the following code to copy all blobs from one storage account into another, in the same resource group:
src_storage_client = BlobServiceClient.from_connection_string(src_storage['connectionString'])
src_container = src_storage_client.get_container_client(src_storage['containerName'])
dst_storage_client = BlobServiceClient.from_connection_string(dst_storage['connectionString'])
dst_container = dst_storage_client.get_container_client(dst_storage['containerName'])
try:
for blob in src_container.list_blobs():
src_blob = BlobClient.from_connection_string(src_storage['connectionString'], src_storage['containerName'], blob.name)
new_blob = BlobClient.from_connection_string(dst_storage['connectionString'], dst_storage['containerName'], blob.name)
new_blob.start_copy_from_url(src_blob.url)
I receive the following error:
azure.core.exceptions.ClientAuthenticationError: Operation returned an invalid status 'Server failed to authenticate the request. Please refer to the information in the www-authenticate header.'
I tried generate_blob_sas and generate_account_sas to no use! I checked out other examples, documentations, and repos but none matched my case, unless I missed something.
Using that same new_blob instance with upload method, it works perfectly. However, I want to copy rather than download-then-upload-again.