
Azure Queue Storage SDK
FreeReliable message queuing for Python applications.
Free · Opens the source repo
What Azure Queue Storage SDK does
The Azure Queue Storage SDK for Python provides a straightforward way to implement message queuing in your applications. This SDK allows developers to leverage Azure's cloud infrastructure for reliable message delivery and asynchronous processing. By using this SDK, you can create, send, receive, and manage messages in queues, making it ideal for task distribution and decoupling components in your software architecture.
Installation is simple, requiring just a pip install command for the SDK and its dependencies. Once set up, you can authenticate using Azure's DefaultAzureCredential, which streamlines the process of accessing your Azure resources securely. The SDK supports various operations such as creating and deleting queues, sending messages with specific visibility and expiration settings, and receiving messages for processing.
The SDK also includes support for asynchronous operations, which is crucial for high-throughput applications. This allows developers to send and receive messages without blocking the main execution thread, enhancing performance in scenarios where message processing speed is critical. Additionally, it supports sending binary data using Base64 encoding, which is useful for applications that need to handle non-textual information.
Best practices are provided to ensure efficient use of the SDK, such as deleting messages after processing to avoid duplicates and using visibility timeouts appropriately. This skill is particularly beneficial for developers looking to implement robust task queues in their applications, ensuring that messages are handled reliably and efficiently.
When to use it
Use this skill when you need to implement asynchronous message processing in your Python applications, particularly when leveraging Azure's cloud services.
When not to use it
Avoid this skill if your application does not require message queuing or if you need advanced messaging features not supported by Azure Queue Storage, such as sessions or topics.
What you can build with it
Task Distribution in Microservices
Use the SDK to implement a task queue that distributes tasks across multiple microservices, ensuring efficient processing.
Asynchronous Background Processing
Leverage the SDK for handling background jobs asynchronously, allowing your application to remain responsive while processing tasks.
Handling Delayed Messages
Utilize the SDK's message visibility options to manage delayed processing of messages, ensuring tasks are executed at the right time.
How to install Azure Queue Storage SDK
View source1. Install with the skills CLI
npx skills add sickn33/agentic-awesome-skills/azure-storage-queue-py --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by sickn33Azure Queue Storage SDK for Python
Simple, cost-effective message queuing for asynchronous communication.
Installation
pip install azure-storage-queue azure-identity
Environment Variables
AZURE_STORAGE_ACCOUNT_URL=https://<account>.queue.core.windows.net
Authentication
from azure.identity import DefaultAzureCredential
from azure.storage.queue import QueueServiceClient, QueueClient
credential = DefaultAzureCredential()
account_url = "https://<account>.queue.core.windows.net"
# Service client
service_client = QueueServiceClient(account_url=account_url, credential=credential)
# Queue client
queue_client = QueueClient(account_url=account_url, queue_name="myqueue", credential=credential)
Queue Operations
# Create queue
service_client.create_queue("myqueue")
# Get queue client
queue_client = service_client.get_queue_client("myqueue")
# Delete queue
service_client.delete_queue("myqueue")
# List queues
for queue in service_client.list_queues():
print(queue.name)
Send Messages
# Send message (string)
queue_client.send_message("Hello, Queue!")
# Send with options
queue_client.send_message(
content="Delayed message",
visibility_timeout=60, # Hidden for 60 seconds
time_to_live=3600 # Expires in 1 hour
)
# Send JSON
import json
data = {"task": "process", "id": 123}
queue_client.send_message(json.dumps(data))
Receive Messages
# Receive messages (makes them invisible temporarily)
messages = queue_client.receive_messages(
messages_per_page=10,
visibility_timeout=30 # 30 seconds to process
)
for message in messages:
print(f"ID: {message.id}")
print(f"Content: {message.content}")
print(f"Dequeue count: {message.dequeue_count}")
# Process message...
# Delete after processing
queue_client.delete_message(message)
Peek Messages
# Peek without hiding (doesn't affect visibility)
messages = queue_client.peek_messages(max_messages=5)
for message in messages:
print(message.content)
Update Message
# Extend visibility or update content
messages = queue_client.receive_messages()
for message in messages:
# Extend timeout (need more time)
queue_client.update_message(
message,
visibility_timeout=60
)
# Update content and timeout
queue_client.update_message(
message,
content="Updated content",
visibility_timeout=60
)
Delete Message
# Delete after successful processing
messages = queue_client.receive_messages()
for message in messages:
try:
# Process...
queue_client.delete_message(message)
except Exception:
# Message becomes visible again after timeout
pass
Clear Queue
# Delete all messages
queue_client.clear_messages()
Queue Properties
# Get queue properties
properties = queue_client.get_queue_properties()
print(f"Approximate message count: {properties.approximate_message_count}")
# Set/get metadata
queue_client.set_queue_metadata(metadata={"environment": "production"})
properties = queue_client.get_queue_properties()
print(properties.metadata)
Async Client
from azure.storage.queue.aio import QueueServiceClient, QueueClient
from azure.identity.aio import DefaultAzureCredential
async def queue_operations():
credential = DefaultAzureCredential()
async with QueueClient(
account_url="https://<account>.queue.core.windows.net",
queue_name="myqueue",
credential=credential
) as client:
# Send
await client.send_message("Async message")
# Receive
async for message in client.receive_messages():
print(message.content)
await client.delete_message(message)
import asyncio
asyncio.run(queue_operations())
Base64 Encoding
from azure.storage.queue import QueueClient, BinaryBase64EncodePolicy, BinaryBase64DecodePolicy
# For binary data
queue_client = QueueClient(
account_url=account_url,
queue_name="myqueue",
credential=credential,
message_encode_policy=BinaryBase64EncodePolicy(),
message_decode_policy=BinaryBase64DecodePolicy()
)
# Send bytes
queue_client.send_message(b"Binary content")
Best Practices
- Delete messages after processing to prevent reprocessing
- Set appropriate visibility timeout based on processing time
- Handle
dequeue_countfor poison message detection - Use async client for high-throughput scenarios
- Use
peek_messagesfor monitoring without affecting queue - Set
time_to_liveto prevent stale messages - Consider Service Bus for advanced features (sessions, topics)
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Frequently asked questions about Azure Queue Storage SDK
Similar skills
WinMD API Search
Easily find and explore Windows desktop APIs.
WebMCPify
Transform any web app into an agent-ready platform.
Phoenix Tracing
Instrument LLM applications with OpenInference tracing.
Foundry Hosted Agent CopilotKit
Guidance for developing agentic web apps on Azure.
Power Automate Foundation
Connect AI agents to Power Automate seamlessly.
Power Automate Flow Builder
Efficiently build and deploy Power Automate flows programmatically.
