May 232014
 
 May 23, 2014  Posted by at 8:16 am Azure, PowerShell  Add comments

A quick post today for dealing with a mystery exception when uploading data to blob storage on Azure with PowerShell. Earlier this week I went to UK and was preparing the podcast with Jonas on SharePoint. I had made some scripts that update the podcast feed, uploads to blob storage and other things and had run them without problem while in Sweden. Suddenly the script threw the following exception:

Set-AzureStorageBlobContent : The remote server returned an error: (403) Forbidden. HTTP Status Code: 403 – HTTP Error Message: Server failed to authenticate the request. Make sure the
value of Authorization header is formed correctly including the signature.
At C:\Users\IrisDaniela\Documents\blob1.ps1:7 char:1
+ Set-AzureStorageBlobContent -Blob “x.mp3” -Container y -F …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureStorageBlobContent], StorageException
+ FullyQualifiedErrorId : StorageException,Microsoft.WindowsAzure.Commands.Storage.Blob.SetAzureBlobContentCommand

Thinking a bit about it, it wasn’t really that suddenly. I had done something in between. I had changed the clock on my computer (just the clock, not the time zone). And if I had read the documentation for Azure Storage Services REST API Reference I had known that the clocks, server and client, has to be synced with no more than 15 minutes difference.

Set-AzureStorageBlobContent The remote server returned an error 403

After setting the clock correctly I had no problems running the script.

Hope this helps in case you ran into the same mysterious message, which after some thought isn’t that mysterious.

  One Response to “Set-AzureStorageBlobContent : The remote server returned an error: (403) Forbidden”

  1. And when one has done nothing to their clock/timezone and prior executions of Set-AzureStorageBlobContent have run without issue…?

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

What is 8 + 6 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)