begincopy rehydrate to a different account java

Vicente 20 Reputation points
2023-08-18T10:40:23.53+00:00

Hey! Im having an issue related to the rehydration process while im trying to make the copy of one blob to another account.

I have two different clients, one for the source and other one for the dest:

BlobClient blobMeta = sourceClient.getBlobContainerClient(source.getContainer())                    .getBlobClient(key);
BlobClient destObject = destClient.getBlobContainerClient(dest.getContainer()).getBlobClient(key);

I read that for doing a copy in a different account, you should use SAS token, so...

OffsetDateTime sasExpiry = OffsetDateTime.now().plusMinutes(1);
BlobSasPermission permission = new BlobSasPermission().setReadPermission(true);
BlobServiceSasSignatureValues sas = new BlobServiceSasSignatureValues(sasExpiry, permission).setStartTime(OffsetDateTime.now());
String sourceURL = blobMeta.getBlobUrl() + "?" + blobMeta.generateSas(sas);

Once i have the different blobs and the SAS token i continue with beginCopy operation setting the new options for the rehydration process (from Archive to Cool and the priority):

destObject.beginCopy(sourceURL, blobMeta.getProperties().getMetadata(), AccessTier.COOL, RehydratePriority.STANDARD, null, null, null);

Everything seems working properly but, this line, creates directly the files with an 0B of size and there is no waiting time for rehydrate process (obviously is not doing nothing, just copying empty info). For the same account in a different container eveything works fine.

Someone has any idea about what can be happening here?

Thank you!

Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,176 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
975 questions
{count} votes

Accepted answer
  1. Sumarigo-MSFT 45,781 Reputation points Microsoft Employee
    2023-09-05T06:47:45.7266667+00:00

    @Vicente I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: Related to the rehydration process while trying to make the copy of one blob to another account.
    I have two different clients, one for the source and another for the destination. I've learned that to perform a copy to a different account, a SAS token should be used. Here's what I've done so far:
    I generated a SAS token with specific permissions for the source blob. I used this token to initiate the beginCopy operation with new options for rehydration (from Archive to Cool and the priority). However, when I execute this operation, it directly creates files with a size of 0B, and there's no waiting time for the rehydrate process. This issue only occurs when copying between different accounts; copying within the same account to a different container works as expected

    Solution: The reason for the issue is that my accounts were located in different regions, and the rehydrate beginCopy method is not supported for this scenario yet. You can find more information about this limitation in the documentation: https://learn.microsoft.com/en-us/azure/storage/blobs/archive-rehydrate-overview


    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Vicente 20 Reputation points
    2023-08-25T08:40:48.8866667+00:00

    I finally found the issue. My accounts where in different region and its not supported for rehydrate begincopy method yet. It is explained in the docs: https://learn.microsoft.com/en-us/azure/storage/blobs/archive-rehydrate-overview

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.