I'm trying to create a queue on Azure cloud. I've an Azure account, namespace and using Service Bus. Due to some restrictions I need to do it using RAW GET/PUT requests so I'm using Simple REST Client.
These are the values mentioned in REST client fields:
URL
https://mynamespace-ns.servicebus.windows.net/
Method
PUT
Headers
PUT /testqueue?timeout=30 HTTP/1.1
x-ms-date: Fri, 25 Sep 2015 03:16:12 GMT
x-ms-version: 2009-09-19
Authorization: SharedKey mynamespace-ns:oucfev8CXZPMsli4t7iZJ+nlC0fUwasyPH5OdSqi9po=
Host: mynamespace-ns.servicebus.windows.net
Content-Length: 0
This is how I'm generating the Authorization key:
HmacSha256 encoding the string "PUT\n\n\n\n0\n\n\n\n\n\n\n\nx-ms-date:Fri, 25 Sep 2015 03:16:12 GMT\nx-ms-version:2009-09-19\n/mynamespace-ns" with secret key is the SharedAccessKey copied from Connection Information page on Azure Portal. After that Base64Encode the resulted string.
Every-time I send the request I got the following response:
401
MalformedToken: Invalid authorization header: The request is missing WRAP authorization credentials. TrackingId:8d52cae0-0dba-470d-8db2-3e76d4fd4d0b_G27,TimeStamp:9/25/2015 9:45:17 AM
Can anyone please tell what I'm missing or am I doing something wrong?
The request has to have an access token attached in the request headers. When using Azure service bus, you need to get a token from the azure access control service. Found this page...
Azure Access Token Patterns
You do not need to use SDK to do all this as I am doing the same from an Android program.
EDIT...
You'll have to adjust this to whatever language you are using.
First get the token...
Your realm will be different since I am accessing service bus and you are creating queues.
Finally when you make your call to create the queue you will have to include the token in your post request like this...