Thoughts, ideas, ramblings. Covering a wide range of topics from Windows to Linux, Azure, hardware, software & more.
Search

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 ;)

Comments

19 Responses

  1. 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!!!

  2. Savior. I wish I would have seen this about 3 hours ago but still saved me all the time to rewrite in ps1. You saved my weekend.

Leave a Reply

Your email address will not be published. Required fields are marked *