Intro

Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. It provides cloud messaging between application components. In designing applications for scale, application components are often decoupled, so that they can scale independently. Queue storage delivers asynchronous messaging for communication between application components, whether they are running in the cloud, on the desktop, on an on-premises server, or on a mobile device. Queue storage also supports managing asynchronous tasks and building workflows.

Prerequisites

Refer to previous posts to get started with Azure Storage Queue Service.

Code

To create a new Azure Storage queue in a default storage account use the following command:

PS C:\WINDOWS\system32> New-AzureStorageQueue -Name pstest74348

CloudQueue              : Microsoft.WindowsAzure.Storage.Queue.CloudQueue
Uri                     : https://default748347.queue.core.windows.net/pstest74348
ApproximateMessageCount :
EncodeMessage           : True
Context                 : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext
Name                    : pstest74348

It will appear in tha Azure Portal right away.

You can get a list of all queues inside the current storage account using the following command:

PS C:\WINDOWS\system32> Get-AzureStorageQueue

CloudQueue              : Microsoft.WindowsAzure.Storage.Queue.CloudQueue
Uri                     : https://default748347.queue.core.windows.net/pstest74348
ApproximateMessageCount : 0
EncodeMessage           : True
Context                 : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext
Name                    : pstest74348

To create an another storage queue in a secondary storage account run the following command:

PS C:\WINDOWS\system32> New-AzureStorageQueue -Name secpstest -Context $ctx

CloudQueue              : Microsoft.WindowsAzure.Storage.Queue.CloudQueue
Uri                     : https://secondary748347.queue.core.windows.net/secpstest
ApproximateMessageCount :
EncodeMessage           : True
Context                 : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext
Name                    : secpstest

To check both storage accounts run the following commands:

PS C:\WINDOWS\system32> Get-AzureStorageQueue -Context $ctx

CloudQueue              : Microsoft.WindowsAzure.Storage.Queue.CloudQueue
Uri                     : https://secondary748347.queue.core.windows.net/secpstest
ApproximateMessageCount : 0
EncodeMessage           : True
Context                 : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext
Name                    : secpstest

PS C:\WINDOWS\system32> Get-AzureStorageQueue

CloudQueue              : Microsoft.WindowsAzure.Storage.Queue.CloudQueue
Uri                     : https://default748347.queue.core.windows.net/pstest74348
ApproximateMessageCount : 0
EncodeMessage           : True
Context                 : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext
Name                    : pstest74348

As you can see, these two queues has been created in two different storage accounts, one in the default storage account and one in the secndary storage account.

Delete both test queues using the following commands:

PS C:\WINDOWS\system32> Remove-AzureStorageQueue -Name pstest74348 -Force
PS C:\WINDOWS\system32> Remove-AzureStorageQueue -Name secpstest -Context $ctx -Force

it will delete queues with no confirmation prompt.

Run commands from step 4 to check that queues has been deleted.

Summary

It is very easy to create and manager Azure Storage queues from Azure PowerShell using Azure Storage cmdlets. More info about Azure Storage cmdlets can be found on MSDN.


;