AzCopy Batch File with SAS Token: The remote server returned an error (403) Forbidden
I was recently trying to copy some files from Azure using an SAS token. It was failing with the following error;
The remote server returned an error: (403) Forbidden.
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
When run manually in the command line — it’d work.
Turns out it was purely because it was running with a batch file, the % signs (common in the SAS Signature) don’t play nice with batch files.
Changing the % in the signature to %% escaped them, and let it run normally.
Hoping this saves someone else 1 hour 😉
You definitely saved my hour. Thank you so much!
Comment by Ash — February 28, 2018 @ 4:53 am
Same weird error, two hours wasted.. 🙁 Now it’s work correctly… Thanks !!!
Comment by Leo — January 16, 2019 @ 3:16 am
Thank you, thank you, thank you. I was stumped for over an hour and this worked!!!
Comment by Krisy — April 8, 2019 @ 11:49 am
Thanks for the assist – hours wasted here until I found this post.
Comment by OBD — June 20, 2019 @ 2:33 pm
Nice, you saved me of messing up!
Comment by nicolas — July 25, 2019 @ 12:18 am
Thanks so much! I was trying to automate a task and had a dozen hurdles to overcome. This was the last hurdle I couldn’t get over. Thank you so much for sharing!!!
Comment by BRV — November 1, 2019 @ 6:36 am
Man, you are a legend!!!!
Comment by Mathieu — November 8, 2019 @ 5:55 am
How did you ever solve this in the first place???
Comment by pawlowski6132 — November 22, 2019 @ 8:30 am
Ditto on Legend – this was driving me nuts until I found this – thank you!!!
Comment by Charles C — November 27, 2019 @ 10:56 am