AzureBlob Upload ERROR:The specified blob already exists

If you want to overwrite the existing blob using Blob storage client library v12, just add overwrite=True in the upload_blob method.

Here is the sample code:

from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient

conn_str = "xxx"
container_name = "test6"

blob_service_client = BlobServiceClient.from_connection_string(conn_str=conn_str)
blob_client = blob_service_client.get_blob_client(container=container_name,blob="a1.txt")

with open("F:\\temp\\a1.txt","rb") as data:
    blob_client.upload_blob(data,overwrite=True)

print("**completed**")

After executing the code, the new blob is uploaded and the existing blob can be overwritten. Screenshot as below:

enter image description here