Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Azure Queue returns 403 Forbidden

Using the following code (I've obfuscated the actual credentials):

CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(new StorageCredentials(username, key), true);
CloudQueueClient clnt = cloudStorageAccount.CreateCloudQueueClient();

string logQueueReference = "log2";
CloudQueue queue = clnt.GetQueueReference(logQueueReference);

queue.CreateIfNotExists();

The following request is generated:

HEAD /log2?comp=metadata&timeout=90 HTTP/1.1
x-ms-version: 2012-02-12
User-Agent: WA-Storage/2.0.6.0
x-ms-date: Tue, 29 Apr 2014 13:26:29 GMT
Authorization: SharedKey username:transformedkey
Host: username.queue.core.windows.net

And the following response is returned:

HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
Transfer-Encoding: chunked
Server: Microsoft-HTTPAPI/2.0
x-ms-request-id: 0cc84a81-73e1-4a8c-bf16-098af2b21149
Date: Tue, 29 Apr 2014 15:26:29 GMT

I've double-double-double checked the credentials. They are copy-pasted from the dialog at manage.windowsazure.com. What am I missing here?

like image 318
Korijn Avatar asked Jun 28 '26 06:06

Korijn


1 Answers

While most common cause for this 403 error is incorrect account key (so I would request you to check it again) however this error may also come if the clock on your computer is off (also known as clock skewness). Please check the clock on your computer and ensure that it is not off way too much. See this thread for more details: 403 error in production from WindowsAzure.Storage.

like image 81
Gaurav Mantri Avatar answered Jun 30 '26 03:06

Gaurav Mantri