How to create a Azure queue using javascript


  • Hi Team,

    I am new to the Azure.

    How to create a queue in the azure using javascript?

    How to insert the message to the queue using javascript?

    Can you please share the sample code?

    Tuesday, May 17, 2016 6:42 AM

All replies

  • Hi,

    Thank you for posting here,

    To create a queue in the azure using java refer below link:

    To insert the message to the queue using java refer below link:


    Vikranth S.

    Please remember to click "Mark as Answer" on the post that helps you, this can be beneficial to other community members reading the thread. And Vote as Helpful.

    • Proposed as answer by Akampa Tuesday, May 17, 2016 3:03 PM
    Tuesday, May 17, 2016 2:44 PM
  • Thank you vikranth,

    But this solution refers to server side code.

    I want to create the azure storage queue using javascript.

    Tuesday, May 17, 2016 5:36 PM
  • Hi -

    All code for working with Azure queues is server-side code. Because Queue storage is a service running in Azure, you can only work with queues by making calls to the service.

    Node.js is the closest language to JavaScript. See here for node.js examples: 

    Thursday, May 19, 2016 12:40 AM
  • Thank you Tamra Myers for reply.

    Yes, Queue storage is running in the azure.But we have the rest api for Azure queue storage.

    But in the Node.js we can import the azure dlls.

    But my requirement is to create a queue from pure javascript/jquery.

    • Edited by sk2014 Thursday, May 19, 2016 6:15 AM
    Thursday, May 19, 2016 6:15 AM
  • To call the rest services from the browser, you need to enable CORS.  

    You can learn more about that here:

    You can use this powershell command to configure CORS on your storage account:

    Once you have CORS configured appropriately, you can call the REST services from Javascript in the browser.  

    It is recommended that you use SAS to authenticate REST calls from browsers, and not distribute your storage account keys.  

    You can learn more about Account SAS here:

    The following is a very basic example of creating a queue from JS in a browser:

    <!DOCTYPE html>
    <html lang="en" xmlns="">
        <meta charset="utf-8" />
        Account: <input id="account" /><br />
        SAS: <input id="sas" /><br />
        Queue: <input id="queue" /><br />
        <button onclick="createQueue()">Create Queue</button>
        <p id="result"></p>
    function createQueue() {
        var data = null;
        var xhr = new XMLHttpRequest();
        xhr.addEventListener("readystatechange", function () {
            if (this.readyState === 4) {
                document.getElementById("result").innerHTML = this.status + " " + this .statusText;
        var url = "https://" + document.getElementById("account").value + "" + document.getElementById("queue").value + "?" + document.getElementById("sas").value;
   "PUT", url);
        xhr.setRequestHeader("content-type", "application/xml");
        xhr.setRequestHeader("cache-control", "no-cache");

    Wednesday, May 25, 2016 6:41 PM