Azure Blob Copy from presigned to presigned url

219 views Asked by At

I'm trying to copy an azure blob from one account to another. I have a destination and a source url with their shared access key.

the request that i've done are:

PUT on  [url with and without sastoken]

Authorization: "SharedAccessSignature [sas token encoded and decoded]"
x-ms-copy-source: "[sourceUri with and without sastoken]"
x-ms-copy-source-authorization: "SharedAccessSignature [sas token encoded and decoded]"
x-ms-requires-sync: "true"
x-ms-date: [example: 2023-01-03T17:27:02Z]
x-ms-version: [taken from destination sastoken]

empty body

In the documentations is not specified the content of the authorization header i've found it on internet. i've tried with and without x-ms-copy-source-authorization header that is reported in the documentation for copy from url but not in copy documentation i'm sure that source url is valid why befor these request i put a file on this blob. destination url is retrieved from an external service and i have no resolution from my machine i can test only after deploy.

if you have any ideas, you are welcome!

1

There are 1 answers

0
Gaurav Mantri On

If you have SAS URL for both source and destination blobs, then you would do a PUT operation using the destination blob SAS URL.

You don't need Authorization header as the destination blob URL already has the authorization information (in the SAS URL).

You would need to specify source blob SAS URL for x-ms-copy-source.

You need not specify x-ms-copy-source-authorization as the source blob URL already has the authorization information (in the SAS URL).

You need not specify x-ms-date and x-ms-version.

To summarize, your request should look something like:

PUT on  [destination blob SAS URL]

x-ms-copy-source: "[source blob SAS URL]"
x-ms-requires-sync: "true"
empty body