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