For our testing purpose, we would like to access Azure storage queue directly with JavaScript instead of preparing a new web service.
Is this possible? What should we do to achieve this, since I cannot find the official documentation for JavaScript API of Azure storage.
Yes, it is certainly possible. In fact, I am currently developing a service which does exactly this.
Step 1: Enable CORS for Queue Service
To accomplish this, first you need to enable CORS settings on your Queue Service. You may find this blog post useful for CORS settings: http://blogs.msdn.com/b/windowsazurestorage/archive/2014/02/03/windows-azure-storage-introducing-cors.aspx. You would have to make following settings:
Allowed Origin: Your domain name
Allowed Verbs: I would start with all the possible verbs but do take a look at REST API documentation for messages
and see which operations you wish to perform and allow only those verbs.
Allowed Headers: *
Exposed Headers: *
Step 2: Get a Shared Access Signature for Queue
Next, you would need to create a Shared Access Signature (SAS) on a queue
and set appropriate permissions. For setting up SAS on Queues, you could make use of Azure Storage Client library. You may find this blog post useful for learning more about SAS on Queues: http://blogs.msdn.com/b/windowsazurestorage/archive/2012/06/12/introducing-table-sas-shared-access-signature-queue-sas-and-update-to-blob-sas.aspx.
Step 3: Access your Queue
Once SAS URL is created, you can take that URL and start using it via jQuery/AJAX in your web application.
来源:https://stackoverflow.com/questions/24691018/how-to-access-azure-storage-queue-by-javascript