O Azure Queue Storage é um serviço na plataforma de nuvem Azure da Microsoft projetado para enfileiramento de mensagens entre componentes de aplicação, permitindo comunicação assíncrona e desacoplamento. Ele permite armazenar um número ilimitado de mensagens, cada uma com até 64 KB de tamanho, e suporta operações como criar e excluir filas, adicionar, recuperar, atualizar e excluir mensagens, além de gerenciar metadados e políticas de acesso. Embora normalmente processe mensagens de maneira FIFO (first-in-first-out), a FIFO estrita não é garantida.
Enumeration
# You need to know the --account-name of the storage (az storage account list)azstoragequeuelist--account-name<storage_account># Queue Metadataazstoragequeuemetadatashow--name<queue_name>--account-name<storage_account>#Get ACLazstoragequeuepolicylist--queue-name<queue_name>--account-name<storage_account># Get Messages (getting a message deletes it)azstoragemessageget--queue-name<queue_name>--account-name<storage_account># Peek Messagesazstoragemessagepeek--queue-name<queue_name>--account-name<storage_account>
# Get the Storage Context$storageAccount = Get-AzStorageAccount -ResourceGroupName QueueResourceGroup -Name queuestorageaccount1994$ctx = $storageAccount.Context# Set Variables for Storage Account$storageAccountName = "queuestorageaccount"# List QueuesGet-AzStorageQueue-Context $context$queueName = "myqueue"# Retrieve a specific queue$queue = Get-AzStorageQueue -Name $queueName -Context $context$queue # Show the properties of the queue# Retrieve the access policies for the queue$accessPolicies = Get-AzStorageQueueStoredAccessPolicy -Context $context -QueueName $queueName$accessPolicies# Peek Messages$queueMessage = $queue.QueueClient.PeekMessage()$queueMessage.Value# Set the amount of time you want to entry to be invisible after read from the queue# If it is not deleted by the end of this time, it will show up in the queue again$visibilityTimeout = [System.TimeSpan]::FromSeconds(10)# Read the messages from the queue, then show the contents of the messages.$queueMessage = $queue.QueueClient.ReceiveMessages(1,$visibilityTimeout)$queueMessage.Value