0
votes

I have a SAS for container (WRITE only, but I tries READ-WRITE-LIST too). And I need to upload a single file to that container. So I use AzCopy for that:

AzCopy /Source:./ /Dest:https://account.blob.core.windows.net/container/?sv=2018-03-28&si=write&sr=c&sig=****** /Pattern:somefile.ext /V:./AzCopy.log

And I tried another version:

AzCopy /Source:somefile.ext /Dest:https://account.blob.core.windows.net/container/somefile.ext /DestSAS:******

but that doesn't work either.

And I tried both AzCopy versions - 7.1.3 and 8.1! What else should I try?

BTW, with Powershell it works like a charm, with the same SAS token! Windows 10 latest.

UPDATE

The log (made on completely different machine):

[2019.03.22 06:39:41.551+03:00] >>>>>>>>>>>>>>>> [2019.03.22 06:39:41.561+03:00][VERBOSE] Finished: 0 file(s), 0 B; Average Speed:0 B/s. [2019.03.22 06:39:41.569+03:00][VERBOSE] 8.1.0 : AzCopy /Source:somefile.ext /Dest:https://account.blob.core.windows.net/korch/somefile.ext /DestSAS:****** /V:./AzCopy with SAS.log [2019.03.22 06:39:41.589+03:00][ERROR] An error occurred while reading the restart journal from "C:\Users\user\AppData\Local\Microsoft\Azure\AzCopy". Detailed error: Error parsing the journal file: Journal file was generated by a different version of AzCopy. [2019.03.22 06:39:43.175+03:00][VERBOSE] [PROMPT] Do you want to overwrite the journal to start a new operation? Choose Yes to overwrite, choose No to cancel current operation. (Yes/No) : Y [2019.03.22 06:39:43.230+03:00][VERBOSE] Attempt to parse address 'somefile.ext' to a directory as a candidate location succeeded. [2019.03.22 06:39:43.232+03:00][VERBOSE] Attempt to parse address 'somefile.ext' to a single file as a candidate location succeeded. [2019.03.22 06:39:43.239+03:00][VERBOSE] Source is interpreted as a Local file: G:\1\somefile.ext. [2019.03.22 06:39:43.260+03:00][VERBOSE] Attempt to parse address 'https://account.blob.core.windows.net/korch/somefile.ext' to a directory as a candidate location succeeded. [2019.03.22 06:39:43.269+03:00][VERBOSE] Attempt to parse address 'https://account.blob.core.windows.net/korch/somefile.ext' to a single file as a candidate location succeeded. [2019.03.22 06:39:43.270+03:00][VERBOSE] Interpreting destination as a single file as the provided source is a single file. [2019.03.22 06:39:43.271+03:00][VERBOSE] Destination is interpreted as a Cloud blob: https://account.blob.core.windows.net/korch/somefile.ext. [2019.03.22 06:39:43.942+03:00][VERBOSE] Start transfer: G:\1\somefile.ext => https://account.blob.core.windows.net/korch/somefile.ext [2019.03.22 06:39:44.149+03:00][VERBOSE] Transfer FAILED: G:\1\somefile.ext => https://account.blob.core.windows.net/korch/somefile.ext. [2019.03.22 06:39:44.158+03:00][ERROR] An unknown error occurred: The transfer failed. Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. HttpStatusMessage:Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:76ffafce-901e-0132-6460-e00b82000000 Time:Fri, 22 Mar 2019 06:39:44 GMT [2019.03.22 06:39:44.161+03:00] Transfer summary: ----------------- Total files transferred: 1 Transfer successfully: 0 Transfer skipped: 0 Transfer failed: 1 Elapsed time: 00.00:00:02

2
You need to specify the SAS for the source also ?Thomas
source is the local file!alvipeo
What's the error message you're getting?Gaurav Mantri
Unauthorized header.alvipeo
Can you please edit your question and include complete error message? I tried both commands you used above and I was able to successfully upload a local file.Gaurav Mantri

2 Answers

1
votes

ok, I created a .CMD file for AzCopy'ing a single file. But I didn't know I had to escape % in windows batch files. That's why SAS token was not correct at the end.

0
votes

Here's what I tried that worked.

AzCopy /Source:D:\temp /Dest:https://account-name.blob.core.windows.net/blob-container-name /DestSAS:"?se=2019-03-30T18%3A30%3A00Z&sp=rw&sv=2018-03-28&sr=c&sig=xxxxx...%3D" /Pattern:test.txt

AzCopy /Source:D:\temp2 /Dest:"https://account-name.blob.core.windows.net/blob-container-name?se=2019-03-30T18%3A30%3A00Z&sp=rw&sv=2018-03-28&sr=c&sig=xxxxx...%3D" /Pattern:test.log

One thing I noticed is that if I just include Write permission, the operation fails. I had to add Read permission in my SAS for the operation to succeed.

Furthermore, I had to include SAS token in double quotes.