When a blob is in the Archive tier, it is set to be offline and cannot be read or modified. Hence, you cannot overwrite a blob which is in the Archive tier.
To overwrite a blob, you have to make sure the blob is online and isn't set to Archive.
This can be achieved using Rehydration in two ways:
Method 1:
- Copy the archived blob to a new destination blob that is in either the
Hot or Cool tier using the Copy Blob operation .
- When you copy an archived blob to a new blob in an online tier, the source blob remains unmodified in the Archive tier.
- Once you have copied the blob to an online tier, you can then overwrite it as needed.
Method 2:
- Changing the Blob's tier from
archive to hot or cool with the Set Blob Tier operation.
I have a Blob in Archive tier:

- To Rehydrate the Archive tier Blob, I've used the below code snippet taken from SO by @Venkatesan:
String sourceConnectionString = "<Source_storage_Connection_string>";
String destConnectionString = "<destination_storage_connection_string>";
String sourceContainerName = "<source_container_name>";//demo
String destContainerName = "<destination_container_name>";//demo
String sourceBlobName = "<your_source_blob_name>";//demoblob/Blob.txt
String destBlobName = "<destination>";//demo.txt
BlobClient sourceBlobClient = new BlobServiceClientBuilder().connectionString(sourceConnectionString)
.buildClient().getBlobContainerClient(sourceContainerName).getBlobClient(sourceBlobName);
BlobClient destBlobClient = new BlobServiceClientBuilder().connectionString(destConnectionString)
.buildClient().getBlobContainerClient(destContainerName).getBlobClient(destBlobName);
// Generating SAS token
OffsetDateTime sasExpiry = OffsetDateTime.now().plusMinutes(1);
BlobSasPermission permission = new BlobSasPermission().setReadPermission(true);
BlobServiceSasSignatureValues sas = new BlobServiceSasSignatureValues(sasExpiry, permission);
String sourceURL = sourceBlobClient.getBlobUrl() + "?" + sourceBlobClient.generateSas(sas);
Map<String, String> metadata = new HashMap<>();
metadata.put("key", "value");
// Performing blob copy with rehydration
destBlobClient.beginCopy(sourceURL, metadata, AccessTier.COOL, RehydratePriority.HIGH, null, null, null);
System.out.println("Blob copy operation is initiated with rehydration.");
Output:


- A copy of the Blob created with
Cool tier:

- You can overwrite the newly generated Blob with cool tier.
References:
Blob rehydration from the archive tier | Microsoft Learn
Rehydrate an archived blob to an online tier - Azure Storage | Microsoft Learn