Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Bicep resource definition
The namespaces/queues resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.ServiceBus/namespaces/queues resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.ServiceBus/namespaces/queues@2025-05-01-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    autoDeleteOnIdle: 'string'
    deadLetteringOnMessageExpiration: bool
    defaultMessageTimeToLive: 'string'
    duplicateDetectionHistoryTimeWindow: 'string'
    enableBatchedOperations: bool
    enableExpress: bool
    enablePartitioning: bool
    forwardDeadLetteredMessagesTo: 'string'
    forwardTo: 'string'
    lockDuration: 'string'
    maxDeliveryCount: int
    maxMessageSizeInKilobytes: int
    maxSizeInMegabytes: int
    requiresDuplicateDetection: bool
    requiresSession: bool
    status: 'string'
    userMetadata: 'string'
  }
}
Property Values
Microsoft.ServiceBus/namespaces/queues
| Name | Description | Value | 
|---|---|---|
| name | The resource name | string Constraints: Min length = 1 (required) | 
| parent | In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource. For more information, see Child resource outside parent resource. | Symbolic name for resource of type: namespaces | 
| properties | Queue Properties | SBQueueProperties | 
SBQueueProperties
| Name | Description | Value | 
|---|---|---|
| autoDeleteOnIdle | ISO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. | string | 
| deadLetteringOnMessageExpiration | A value that indicates whether this queue has dead letter support when a message expires. | bool | 
| defaultMessageTimeToLive | ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. | string | 
| duplicateDetectionHistoryTimeWindow | ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. | string | 
| enableBatchedOperations | Value that indicates whether server-side batched operations are enabled. | bool | 
| enableExpress | A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. | bool | 
| enablePartitioning | A value that indicates whether the queue is to be partitioned across multiple message brokers. | bool | 
| forwardDeadLetteredMessagesTo | Queue/Topic name to forward the Dead Letter message | string | 
| forwardTo | Queue/Topic name to forward the messages | string | 
| lockDuration | ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. | string | 
| maxDeliveryCount | The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10. | int | 
| maxMessageSizeInKilobytes | Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. | int | 
| maxSizeInMegabytes | The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024. | int | 
| requiresDuplicateDetection | A value indicating if this queue requires duplicate detection. | bool | 
| requiresSession | A value that indicates whether the queue supports the concept of sessions. | bool | 
| status | Enumerates the possible values for the status of a messaging entity. | 'Active' 'Creating' 'Deleting' 'Disabled' 'ReceiveDisabled' 'Renaming' 'Restoring' 'SendDisabled' 'Unknown' | 
| userMetadata | Gets and Sets Metadata of User. | string | 
Usage Examples
Azure Quickstart Samples
The following Azure Quickstart templates contain Bicep samples for deploying this resource type.
| Bicep File | Description | 
|---|---|
| Create a Service Bus namespace and queue | This template enables you to deploy a Service Bus Standard namespace and a queue. | 
| Create Azure Event Grid Custom Topic and Queue Subscription | Creates an Azure Event Grid custom topic and a service bus queue subscription. Template originally authored by Markus Meyer. | 
ARM template resource definition
The namespaces/queues resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.ServiceBus/namespaces/queues resource, add the following JSON to your template.
{
  "type": "Microsoft.ServiceBus/namespaces/queues",
  "apiVersion": "2025-05-01-preview",
  "name": "string",
  "properties": {
    "autoDeleteOnIdle": "string",
    "deadLetteringOnMessageExpiration": "bool",
    "defaultMessageTimeToLive": "string",
    "duplicateDetectionHistoryTimeWindow": "string",
    "enableBatchedOperations": "bool",
    "enableExpress": "bool",
    "enablePartitioning": "bool",
    "forwardDeadLetteredMessagesTo": "string",
    "forwardTo": "string",
    "lockDuration": "string",
    "maxDeliveryCount": "int",
    "maxMessageSizeInKilobytes": "int",
    "maxSizeInMegabytes": "int",
    "requiresDuplicateDetection": "bool",
    "requiresSession": "bool",
    "status": "string",
    "userMetadata": "string"
  }
}
Property Values
Microsoft.ServiceBus/namespaces/queues
| Name | Description | Value | 
|---|---|---|
| apiVersion | The api version | '2025-05-01-preview' | 
| name | The resource name | string Constraints: Min length = 1 (required) | 
| properties | Queue Properties | SBQueueProperties | 
| type | The resource type | 'Microsoft.ServiceBus/namespaces/queues' | 
SBQueueProperties
| Name | Description | Value | 
|---|---|---|
| autoDeleteOnIdle | ISO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. | string | 
| deadLetteringOnMessageExpiration | A value that indicates whether this queue has dead letter support when a message expires. | bool | 
| defaultMessageTimeToLive | ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. | string | 
| duplicateDetectionHistoryTimeWindow | ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. | string | 
| enableBatchedOperations | Value that indicates whether server-side batched operations are enabled. | bool | 
| enableExpress | A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. | bool | 
| enablePartitioning | A value that indicates whether the queue is to be partitioned across multiple message brokers. | bool | 
| forwardDeadLetteredMessagesTo | Queue/Topic name to forward the Dead Letter message | string | 
| forwardTo | Queue/Topic name to forward the messages | string | 
| lockDuration | ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. | string | 
| maxDeliveryCount | The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10. | int | 
| maxMessageSizeInKilobytes | Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. | int | 
| maxSizeInMegabytes | The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024. | int | 
| requiresDuplicateDetection | A value indicating if this queue requires duplicate detection. | bool | 
| requiresSession | A value that indicates whether the queue supports the concept of sessions. | bool | 
| status | Enumerates the possible values for the status of a messaging entity. | 'Active' 'Creating' 'Deleting' 'Disabled' 'ReceiveDisabled' 'Renaming' 'Restoring' 'SendDisabled' 'Unknown' | 
| userMetadata | Gets and Sets Metadata of User. | string | 
Usage Examples
Azure Quickstart Templates
The following Azure Quickstart templates deploy this resource type.
| Template | Description | 
|---|---|
| Create a Service Bus namespace and queue | This template enables you to deploy a Service Bus Standard namespace and a queue. | 
| Create Azure Event Grid Custom Topic and Queue Subscription | Creates an Azure Event Grid custom topic and a service bus queue subscription. Template originally authored by Markus Meyer. | 
Terraform (AzAPI provider) resource definition
The namespaces/queues resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.ServiceBus/namespaces/queues resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
  type = "Microsoft.ServiceBus/namespaces/queues@2025-05-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      autoDeleteOnIdle = "string"
      deadLetteringOnMessageExpiration = bool
      defaultMessageTimeToLive = "string"
      duplicateDetectionHistoryTimeWindow = "string"
      enableBatchedOperations = bool
      enableExpress = bool
      enablePartitioning = bool
      forwardDeadLetteredMessagesTo = "string"
      forwardTo = "string"
      lockDuration = "string"
      maxDeliveryCount = int
      maxMessageSizeInKilobytes = int
      maxSizeInMegabytes = int
      requiresDuplicateDetection = bool
      requiresSession = bool
      status = "string"
      userMetadata = "string"
    }
  }
}
Property Values
Microsoft.ServiceBus/namespaces/queues
| Name | Description | Value | 
|---|---|---|
| name | The resource name | string Constraints: Min length = 1 (required) | 
| parent_id | The ID of the resource that is the parent for this resource. | ID for resource of type: namespaces | 
| properties | Queue Properties | SBQueueProperties | 
| type | The resource type | "Microsoft.ServiceBus/namespaces/queues@2025-05-01-preview" | 
SBQueueProperties
| Name | Description | Value | 
|---|---|---|
| autoDeleteOnIdle | ISO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. | string | 
| deadLetteringOnMessageExpiration | A value that indicates whether this queue has dead letter support when a message expires. | bool | 
| defaultMessageTimeToLive | ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. | string | 
| duplicateDetectionHistoryTimeWindow | ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. | string | 
| enableBatchedOperations | Value that indicates whether server-side batched operations are enabled. | bool | 
| enableExpress | A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. | bool | 
| enablePartitioning | A value that indicates whether the queue is to be partitioned across multiple message brokers. | bool | 
| forwardDeadLetteredMessagesTo | Queue/Topic name to forward the Dead Letter message | string | 
| forwardTo | Queue/Topic name to forward the messages | string | 
| lockDuration | ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. | string | 
| maxDeliveryCount | The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10. | int | 
| maxMessageSizeInKilobytes | Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. | int | 
| maxSizeInMegabytes | The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024. | int | 
| requiresDuplicateDetection | A value indicating if this queue requires duplicate detection. | bool | 
| requiresSession | A value that indicates whether the queue supports the concept of sessions. | bool | 
| status | Enumerates the possible values for the status of a messaging entity. | 'Active' 'Creating' 'Deleting' 'Disabled' 'ReceiveDisabled' 'Renaming' 'Restoring' 'SendDisabled' 'Unknown' | 
| userMetadata | Gets and Sets Metadata of User. | string | 
Usage Examples
Terraform Samples
A basic example of deploying ServiceBus Queue.
terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}
provider "azapi" {
  skip_provider_registration = false
}
variable "resource_name" {
  type    = string
  default = "acctest0001"
}
variable "location" {
  type    = string
  default = "westeurope"
}
resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}
resource "azapi_resource" "namespace" {
  type      = "Microsoft.ServiceBus/namespaces@2022-01-01-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      disableLocalAuth    = false
      publicNetworkAccess = "Enabled"
      zoneRedundant       = false
    }
    sku = {
      capacity = 0
      name     = "Standard"
      tier     = "Standard"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}
resource "azapi_resource" "queue" {
  type      = "Microsoft.ServiceBus/namespaces/queues@2021-06-01-preview"
  parent_id = azapi_resource.namespace.id
  name      = var.resource_name
  body = {
    properties = {
      deadLetteringOnMessageExpiration = false
      enableBatchedOperations          = true
      enableExpress                    = false
      enablePartitioning               = true
      maxDeliveryCount                 = 10
      maxSizeInMegabytes               = 81920
      requiresDuplicateDetection       = false
      requiresSession                  = false
      status                           = "Active"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}