Sunday, 16 September 2018

Delete a Queue in Microsoft Azure storage account.

In this post we are going to see how to delete a queue in Microsoft Azure storage account.

Install the Following package
1. WindowsAzure.Storage
2. Install-Package Microsoft.WindowsAzure.ConfigurationManager -Version 3.2.3

class Program
    {

        // Nuget Packages
        // -Install-Package Microsoft.WindowsAzure.ConfigurationManager -Version 3.2.3
        static void Main(string[] args)
        {
            CloudStorageAccount account = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("azureStorageAccount"));
            var queueClient = account.CreateCloudQueueClient();

            /* Get the reference of the queue */
            var testQueue = queueClient.GetQueueReference("testingqueue");

            /* Deleting the queue if exists */
            testQueue.DeleteIfExists();

        }

    }

From the above code you can learn how to delete a queue in Microsoft Azure storage account.

No comments:

Post a Comment