I am using the azure-sdk for python to copy a blob in the same container. But I am getting authentication error.
the source code is:
status = None
blob_service_client = BlobServiceClient.from_connection_string(storage_account_connection_string)
copied_blob = blob_service_client.get_blob_client(containerName, 'test.csv')
result = copied_blob.start_copy_from_url(source_url=source_blob, requires_sync=True)
print(result)
status = result['copy_status']
if status != "success":
for i in range(1000):
props = copied_blob.get_blob_properties()
status = props.copy.status
print("Copy status: " + status)
if status == "success":
# copy finished
break
time.sleep(60*0.5)
And I am getting the error:
ClientAuthenticationError: Server failed to authenticate the request. Please refer to the information in the www-authenticate header. Time:2024-01-10T14:36:11.9520689Z ErrorCode:CannotVerifyCopySource Content:
CannotVerifyCopySourceServer failed to authenticate the request. Please refer to the information in the www-authenticate header. Time:2024-01-10T14:36:11.9520689Z
Can anyone help me with this?

Use the below Python code to copy a blob in the same container using Azure SDK for Python.
Code:
Output:
Portal:
Reference:
azure.storage.blob.BlobClient class | Microsoft Learn