What is Azure Queue Storage?
Introduction to Azure Queue Storage – Azure Storage | Microsoft Docs
Azure Queue Storage is a service for storing large numbers of messages. You access messages from anywhere in the world via authenticated calls using HTTP or HTTPS. A queue message can be up to 64 KB in size. A queue may contain millions of messages, up to the total capacity limit of a storage account. Queues are commonly used to create a backlog of work to process asynchronously.
Queue service REST API – Azure Storage | Microsoft Docs
How to view the messages?
Authorize requests to Azure Storage (REST API) | Microsoft Docs
https://docs.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal
View account access keys
You can use either of the two keys to access Azure Storage, but in general it’s a good practice to use the first key, and reserve the use of the second key for when you are rotating keys.
Use Azure Key Vault to manage your access keys
Microsoft recommends using Azure Key Vault to manage and rotate your access keys. Your application can securely access your keys in Key Vault, so that you can avoid storing them with your application code. For more information about using Key Vault for key management
You can use either of the two keys to access Azure Storage, but in general it’s a good practice to use the first key, and reserve the use of the second key for when you are rotating keys.
Lets do Python:
Azure Storage Queues client library for Python
QueueServiceClient – this client represents interaction with the Azure storage account itself, and allows you to acquire preconfigured client instances to access the queues within. It provides operations to retrieve and configure the account properties as well as list, create, and delete queues within the account. To perform operations on a specific queue, retrieve a client using the get_queue_client method.
QueueClient – this client represents interaction with a specific queue (which need not exist yet). It provides operations to create, delete, or configure a queue and includes operations to send, receive, peek, delete, and update messages within it.
The above URL together with Azure is super important for setting correct properties for the queue and the msg
How to use Azure Queue Storage from Python | Microsoft Docs
Configure your storage connection string
Windows
cmd
Copy
setx AZURE_STORAGE_CONNECTION_STRING “
Linux
Bash
Copy
export AZURE_STORAGE_CONNECTION_STRING=”
Python
Copy
# Retrieve the connection string from an environment
# variable named AZURE_STORAGE_CONNECTION_STRING
connect_str = os.getenv(“AZURE_STORAGE_CONNECTION_STRING”)
In this example we will use access key, not the connection string, the access key as mentioned can be stored in key vault.
QueueServiceClient:
- List queues
QueueClient:
- Create a queue
- Insert a message into a queue
- Peek at messages
- Change the contents of a queued message
- Get the queue length
- Dequeue messages (next message in the queue by default or get messages in batches)
- Delete a queue
We made a queue in our storage account, nothing fancy
We will insert some messages, view then in the portal and then dequeue them in batches of 2
List queues and insert in explorerqueue:
The queue is now empty
List and insert:
Vie the msg in the portal
Now read them in batches of 2 and 2
Result
And the portal is empty
There is also a REST SERVICE for almost everything in Azure