Azure Service Bus Naming Conventions: Namespaces, Queues, and Topics
CAF naming for Azure Service Bus. The namespace is a globally unique servicebus.windows.net endpoint (6 to 50 chars); queues, topics, and subscriptions inside are relaxed. Patterns and examples.
An Azure Service Bus namespace name is a globally unique DNS endpoint (
<name>.servicebus.windows.net), so it must be 6 to 50 characters, alphanumerics and hyphens, and start with a letter:sbns-payments-prod-eus-001. The queues, topics, and subscriptions inside it are namespace-scoped and relaxed, so keep them short and purpose-named, likesbq-orders.
Service Bus naming follows the same two-layer pattern as SQL and Cosmos DB. The namespace is a globally visible DNS endpoint with strict rules. Everything inside it, queues, topics, and subscriptions, is privately scoped and generous. Name the namespace carefully, then keep the rest short and descriptive.
The pieces and their rules
| Resource | CAF prefix | Length | Characters | Unique within |
|---|---|---|---|---|
| Namespace | sbns | 6-50 | Alphanumerics and hyphens | All of Azure (global) |
| Queue | sbq | 1-260 | Alphanumerics, periods, hyphens, underscores, slashes | Its namespace |
| Topic | sbt | 1-260 | Same as queue | Its namespace |
| Subscription | sbts | 1-50 | Alphanumerics, periods, hyphens, underscores | Its topic |
The namespace becomes <name>.servicebus.windows.net, which is why it must be globally unique, start with a letter, and end with a letter or number. Everything inside it is addressed relative to the namespace, so those names only need to be unique within their parent.
Naming the namespace
Use the full CAF pattern:
sbns-{workload}-{environment}-{region}-{instance}
| Scenario | Namespace name |
|---|---|
| Payments messaging, production | sbns-payments-prod-eus-001 |
| Order processing, dev | sbns-orders-dev-eus-001 |
| Shared integration bus, production | sbns-integration-prod-eus-001 |
Because the name is globally unique, keep the region abbreviation and instance number for entropy, a generic sbns-orders-prod may already be taken by another tenant. The 6-character minimum is easy to clear with the CAF pattern.
Naming queues, topics, and subscriptions
The namespace name already carries the workload, environment, and region. Repeating that inside is noise. Name queues and topics after the message they carry, and subscriptions after their consumer:
sbns-payments-prod-eus-001
├── sbq-orders (queue)
├── sbq-notifications (queue)
└── sbt-order-events (topic)
├── sbts-fulfillment (subscription for the fulfillment service)
└── sbts-analytics (subscription for the analytics pipeline)
Queue and topic names allow slashes, so you can namespace them if you have many: orders/priority, orders/standard. Subscriptions are scoped to a single topic, so name them for the downstream consumer that reads them, which makes the message flow readable at a glance.
Related messaging services
Service Bus is one of several messaging services, each with its own namespace and prefixes:
| Service | Namespace prefix | Entity prefix |
|---|---|---|
| Service Bus | sbns | sbq, sbt, sbts |
| Event Hubs | evhns | evh |
| Event Grid | (topic) | evgt, evgd |
| Relay | rly |
Event Hubs namespaces follow the same globally-unique, 6 to 50 character rule as Service Bus, since they are also servicebus.windows.net endpoints under the hood.
Naming in Terraform
resource "azurerm_servicebus_namespace" "main" {
name = "sbns-${var.workload}-${var.environment}-${var.region}-001"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
sku = "Standard"
}
resource "azurerm_servicebus_queue" "orders" {
name = "sbq-orders"
namespace_id = azurerm_servicebus_namespace.main.id
}
resource "azurerm_servicebus_topic" "order_events" {
name = "sbt-order-events"
namespace_id = azurerm_servicebus_namespace.main.id
}
resource "azurerm_servicebus_subscription" "fulfillment" {
name = "sbts-fulfillment"
topic_id = azurerm_servicebus_topic.order_events.id
max_delivery_count = 10
}
The namespace name is built from variables so every environment derives it the same way; the entity names stay short and purpose-driven.
Common mistakes
Repeating the namespace context in queue names. A queue named sbq-payments-prod-orders inside sbns-payments-prod-eus-001 says everything twice. Call it sbq-orders.
A namespace that is not globally unique. Short generic names collide with other tenants. Keep the region and instance number.
Naming subscriptions after the topic instead of the consumer. A subscription is one reader of a topic, so name it for what reads it (sbts-fulfillment), not for the topic it belongs to.
Summary
- Namespace: 6 to 50 characters, alphanumerics and hyphens, globally unique, it becomes a
servicebus.windows.netendpoint - Queues and topics: namespace-scoped and relaxed, name them by message type, slashes allowed for hierarchy
- Subscriptions: topic-scoped, name them for the downstream consumer
- Build the namespace name from variables in IaC, and keep entities short
Full rules are on the Service Bus namespace naming page. AzureNamer generates namespace and entity names with the right constraints applied. See the SQL and Cosmos DB guides for the same globally-unique endpoint pattern, and the complete CAF guide for the fundamentals.
Keep reading
Azure API Management Naming Conventions: Service, APIs, and Products
CAF naming for Azure API Management. The service is a globally unique azure-api.net endpoint (1 to 50 chars); APIs, products, backends, and named values inside are function-named. Patterns and examples.
Read →Azure Logic App Naming Conventions: Consumption vs Standard
Naming Azure Logic Apps with CAF. Consumption workflows are resource-group scoped (1 to 43 characters); Standard logic apps are Microsoft.Web hostnames (globally unique, 2 to 60). Plus Terraform.
Read →Azure Container Registry Naming: Rules, Limits, and CAF Patterns
Azure Container Registry name requirements: 5 to 50 characters, lowercase alphanumeric only, no hyphens, globally unique. The CAF pattern, examples, and Terraform and Bicep.
Read →Try AzureNamer
Generate CAF compliant names for all 200+ Azure resource types, free, no login required.
Open the Generator →