100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Azure Service Bus Cheat Sheet

Azure Service Bus Cheat Sheet

Queues, topics, subscriptions, and CLI/SDK patterns for reliable enterprise messaging on Azure Service Bus.

2 PagesIntermediateApr 14, 2026

Create Namespace, Queue & Topic (CLI)

Provision a Service Bus namespace with a queue and a topic/subscription.

bash
az servicebus namespace create \  --resource-group rg-messaging \  --name sb-orders-ns \  --sku Standardaz servicebus queue create \  --resource-group rg-messaging \  --namespace-name sb-orders-ns \  --name orders-queue \  --max-delivery-count 10az servicebus topic create \  --resource-group rg-messaging \  --namespace-name sb-orders-ns \  --name orders-topicaz servicebus topic subscription create \  --resource-group rg-messaging \  --namespace-name sb-orders-ns \  --topic-name orders-topic \  --name billing-sub

Send & Receive Messages (Python SDK)

Use azure-servicebus to send a message and process it with peek-lock.

python
from azure.servicebus import ServiceBusClient, ServiceBusMessageconn_str = "Endpoint=sb://sb-orders-ns.servicebus.windows.net/;..."with ServiceBusClient.from_connection_string(conn_str) as client:    with client.get_queue_sender("orders-queue") as sender:        sender.send_messages(ServiceBusMessage("order-123", content_type="text/plain"))    with client.get_queue_receiver("orders-queue", max_wait_time=5) as receiver:        for msg in receiver:            print(str(msg))            receiver.complete_message(msg)  # removes it from the queue

SQL Filter on a Subscription

Route only high-priority messages to a subscription using a SQL filter rule.

bash
az servicebus topic subscription rule create \  --resource-group rg-messaging \  --namespace-name sb-orders-ns \  --topic-name orders-topic \  --subscription-name billing-sub \  --name HighPriorityOnly \  --filter-sql-expression "priority = 'high'"

Core Concepts

Terminology used across the Service Bus data plane.

  • Queue- point-to-point messaging, one consumer processes each message
  • Topic/Subscription- pub/sub; each subscription gets a copy matching its filter
  • Peek-lock- default receive mode; message is locked, must be completed/abandoned
  • Dead-letter queue (DLQ)- holds messages that exceed max delivery count or expire
  • Sessions- guarantee FIFO ordering and state for a group of related messages
  • Duplicate detection- namespace-level window to drop duplicate MessageIds
Pro Tip

Enable sessions only when you truly need FIFO per key (e.g. per customer) — session-enabled queues force every receiver to accept a session lock, which hurts throughput if you don't actually need ordering.

Was this cheat sheet helpful?

Explore Topics

#AzureServiceBus#AzureServiceBusCheatSheet#CloudComputing#Intermediate#Create#Namespace#Queue#Topic#DataStructures#CommandLine#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech

Professional Web Designing Services

  • Responsive Websites
  • E-commerce Solutions
  • SEO Friendly Design
  • Fast & Secure
  • Support & Maintenance
Get a Free Quote

Share this Cheat Sheet