AzCopy copy run from a batch file in Windows command prompt failure
Asked Answered
S

3

5

I'm using AzCopy to copy a file from local server to Azure and coming up with the following failed operation is the command is run from a batch file. If the same command is run from the command prompt the operation is successful.


Run from a batch file - fails:

C:\ftp>AzCopy /Source:C:\ftp\ /Dest:"https://companystrg01.file.core.wind ows.net/bss?sv=2016-05-31&si=bss-supersecretstring" /S

Incomplete operation with same command line detected at the journal directory "C :\Users\Administrator\AppData\Local\Microsoft\Azure\AzCopy", do you want to resume the operation?

Choose Yes to resume, choose No to overwrite the journal to start a new operation. (Yes/No) y

[2018/03/19 13:50:22][ERROR] C:\ftp\board\file.TXT: The transfer fail ed.

The remote server returned an error: (403) Forbidden. HttpStatusMessage:Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:

Time:Mon, 19 Mar 2018 03:50:05 GMT Finished 0 of total 1 file(s). [2018/03/19 13:50:22] Transfer summary:

Total files transferred: 1

Transfer successfully: 0

Transfer skipped: 0

Transfer failed: 1

Elapsed time: 00.00:00:04

================================

Run form a command line - succeeds:

C:\ftp>AzCopy /Source:C:\ftp\ /Dest:"https://companystrg01.file.core.wind ows.net/bss?sv=2016-05-31&si=bss-supersecretstring" /S

[2018/03/19 13:56:57][WARNING] The command line "AzCopy /Source:C:\ftp\board\ /D est:"https://companystrg01.file.core.windows.net/bss?sv=2016-05-31&si=bss-supersecretstring" /S" in the journal file "C:\Users\Administrator\AppData\ Local\Microsoft\Azure\AzCopy\AzCopy.jnl" is different from your input.

[2018/03/19 13:56:57][WARNING] Incomplete operation with different command line detected at the journal directory "C:\Users\Administrator\AppData\Local\Microsof t\Azure\AzCopy".

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 Overwrite https://companystrg01.file.core.windows.net/bss/file.TXT w ith C:\ftp\board\file.TXT? (Yes/No/All) y Finished 1 of total 1 file(s). [2018/03/19 13:57:06] Transfer summary:

Total files transferred: 1

Transfer successfully: 1

Transfer skipped: 0

Transfer failed: 0

Elapsed time: 00.00:00:09

C:\ftp>


I would appreciate some guidance.

Thank you.

Spurtle answered 19/3, 2018 at 4:39 Comment(0)
L
6

You need to escape the special characters in your batch file. See a similar question here: Batch character escaping

Loricate answered 19/3, 2018 at 6:15 Comment(0)
R
3

Simply escape % sign with %% in your SAS token even if it is wrapped within ""!

Reichenberg answered 1/4, 2021 at 9:56 Comment(0)
C
0

Now it's not necessary to escape sign % on Windows OS.

Clausen answered 27/2, 2023 at 13:37 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Interlace

© 2022 - 2024 — McMap. All rights reserved.