Enable partitioning in Azure Service Bus basic or standard
Service Bus partitions enable queues and topics, or messaging entities, to be partitioned across multiple message brokers. Partitioning means that the overall throughput of a partitioned entity is no longer limited by the performance of a single message broker. In addition, a temporary outage of a message broker, for example during an upgrade, doesn't render a partitioned queue or topic unavailable. Partitioned queues and topics can contain all advanced Service Bus features, such as support for transactions and sessions. For more information, see Partitioned queues and topics. This article shows you different ways to enable duplicate message detection for a Service Bus queue or a topic.
Important
- Partitioning is available at entity creation for all queues and topics in Basic or Standard SKUs.
- It's not possible to change the partitioning option on any existing queue or topic. You can only set the option when you create a queue or a topic.
- In a Standard tier namespace, you can create Service Bus queues and topics in 1, 2, 3, 4, or 5-GB sizes (the default is 1 GB). With partitioning enabled, Service Bus creates 16 copies (16 partitions) of the entity, each of the same size specified. As such, if you create a queue that's 5 GB in size, with 16 partitions the maximum queue size becomes (5 * 16) = 80 GB.
Use Azure portal
When creating a queue in the Azure portal, select Enable partitioning as shown in the following image.
When creating a topic in the Azure portal, select Enable partitioning as shown in the following image.
Use Azure CLI
To create a queue with partitioning enabled, use the az servicebus queue create
command with --enable-partitioning
set to true
.
az servicebus queue create \
--resource-group myresourcegroup \
--namespace-name mynamespace \
--name myqueue \
--enable-partitioning true
To create a topic with partitioning enabled, use the az servicebus topic create
command with --enable-partitioning
set to true
.
az servicebus topic create \
--resource-group myresourcegroup \
--namespace-name mynamespace \
--name mytopic \
--enable-partitioning true
Use Azure PowerShell
To create a queue with partitioning enabled, use the New-AzServiceBusQueue
command with -EnablePartitioning
set to $True
.
New-AzServiceBusQueue -ResourceGroup myresourcegroup `
-NamespaceName mynamespace `
-QueueName myqueue `
-EnablePartitioning $True
To create a topic with partitioning enabled, use the New-AzServiceBusTopic
command with -EnablePartitioning
set to true
.
New-AzServiceBusTopic -ResourceGroup myresourcegroup `
-NamespaceName mynamespace `
-Name mytopic `
-EnablePartitioning $True
Use Azure Resource Manager template
To create a queue with partitioning enabled, set enablePartitioning
to true
in the queue properties section. For more information, see Microsoft.ServiceBus namespaces/queues template reference.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"serviceBusNamespaceName": {
"type": "string",
"metadata": {
"description": "Name of the Service Bus namespace"
}
},
"serviceBusQueueName": {
"type": "string",
"metadata": {
"description": "Name of the Queue"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"resources": [
{
"type": "Microsoft.ServiceBus/namespaces",
"apiVersion": "2018-01-01-preview",
"name": "[parameters('serviceBusNamespaceName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"properties": {},
"resources": [
{
"type": "Queues",
"apiVersion": "2017-04-01",
"name": "[parameters('serviceBusQueueName')]",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', parameters('serviceBusNamespaceName'))]"
],
"properties": {
"enablePartitioning": true
}
}
]
}
]
}
To create a topic with duplicate detection enabled, set enablePartitioning
to true
in the topic properties section. For more information, see Microsoft.ServiceBus namespaces/topics template reference.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"service_BusNamespace_Name": {
"type": "string",
"metadata": {
"description": "Name of the Service Bus namespace"
}
},
"serviceBusTopicName": {
"type": "string",
"metadata": {
"description": "Name of the Topic"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"resources": [
{
"apiVersion": "2018-01-01-preview",
"name": "[parameters('service_BusNamespace_Name')]",
"type": "Microsoft.ServiceBus/namespaces",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"properties": {},
"resources": [
{
"apiVersion": "2017-04-01",
"name": "[parameters('serviceBusTopicName')]",
"type": "topics",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/', parameters('service_BusNamespace_Name'))]"
],
"properties": {
"enablePartitioning": true
}
}
]
}
]
}
Next steps
Try the samples in the language of your choice to explore Azure Service Bus features.
- Azure Service Bus client library samples for .NET (latest)
- Azure Service Bus client library samples for Java (latest)
- Azure Service Bus client library samples for Python
- Azure Service Bus client library samples for JavaScript
- Azure Service Bus client library samples for TypeScript
Find samples for the older .NET and Java client libraries below:
- Azure Service Bus client library samples for .NET (legacy)
- Azure Service Bus client library samples for Java (legacy)
Note
On 30 September 2026, we'll retire the Azure Service Bus SDK libraries WindowsAzure.ServiceBus, Microsoft.Azure.ServiceBus, and com.microsoft.azure.servicebus, which don't conform to Azure SDK guidelines. We'll also end support of the SBMP protocol, so you'll no longer be able to use this protocol after 30 September 2026. Migrate to the latest Azure SDK libraries, which offer critical security updates and improved capabilities, before that date.
Although the older libraries can still be used beyond 30 September 2026, they'll no longer receive official support and updates from Azure. For more information, see the support retirement announcement.