Azure Storage Queue

Insert a JSON string message in a storage queue in response to events from VSTS. For example, you can insert a queue message when a work item is created or changed, or a build occurs.

The storage queue provides reliable, persistent messaging within and between services. Messages can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. A single queue message can be up to 64 KB in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account.

Create a Microsoft Azure storage account

  1. If you don't have a Microsoft Azure account, get one here.

  2. In the Microsoft Azure portal, at the bottom of the navigation pane, click NEW.

    Click NEW

  3. Click DATA SERVICES, then STORAGE, and then click QUICK CREATE.

    • In URL, type a subdomain name to use in the URI for the storage account. The entry can contain from 3-24 lowercase letters and numbers. This value becomes the host name within the URI that is used to address Blob, Queue, or Table resources for the subscription.

    • Choose a Region/Affinity Group in which to locate the storage. If you plan to use storage from your Azure application, select the same region where you will deploy your application.

    • Optionally, you can enable geo-replication.


    Configure new storage account

  4. Select the storage account and click MANAGE ACCESS KEYS.

    Open manage access keys

  5. Copy the storage account name and primary acccess key. You need to provide these values when you create a Service Hook subscription.

    Copy name and primary key values

You do not have to add a storage queue. This can be done when you create a service hook subscription.

Create a service hook subscription

  1. Go to your VSTS project service hooks page: https://{account_name}{project_name}/_apps/hub/ms.vss-servicehooks-web.manageServiceHooks-project

    Team project administration page

    Click Create Subscription.

  2. Pick the VSTS event to use as a trigger to insert a message in a storage queue.

    Configure the event

  3. Enter the storage account name and the queue where you want to insert the event into. For the account key, use the primary access key value that you copied when you managed the access keys.

    Configure the action

  4. Test the service hook subscription and finish the wizard.

    Test the subscription

Now the event is set up. Your messages are put into the Azure storage queue and are available for reading.

Reading messages from the queue (.NET Framework)

An event matching a Service Hook subscription will be added to the selected storage queue as a JSON string. You can then use APIs provided by the Microsoft Azure SDK for .NET Framework (and other languages) to access the message:

  1. How to: Peek at the next message

  2. How to: Dequeue the next message


    // Retrieve storage account from connection string
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(

    // Create the queue client
    CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();

    // Retrieve a reference to a queue
    CloudQueue queue = queueClient.GetQueueReference("myqueue");

    // Get the next message
    CloudQueueMessage retrievedMessage = queue.GetMessage();

    //Process the message in less than 30 seconds, and then delete the message


VSTS doesn't charge for the framework for integrating with external services. Check out the specific service's site for pricing related to their services.

Q & A

Q: Can I get more information about Microsoft Azure storage?

A: Yes, go here.

Q: Can I programmatically create subscriptions?

A: Yes, see details [here](../../integrate/get-started/service-hooks/create-subscription.