Quickstart: Create a Service Bus namespace and a queue using an Azure Resource Manager template

This article shows how to use an Azure Resource Manager template that creates a Service Bus namespace and a queue within that namespace. The article explains how to specify which resources are deployed and how to define parameters that are specified when the deployment is executed. You can use this template for your own deployments, or customize it to meet your requirements.

For more information about creating templates, please see Authoring Azure Resource Manager templates.

For the complete template, see the Service Bus namespace and queue template on GitHub.


The following Azure Resource Manager templates are available for download and deployment.

To check for the latest templates, visit the Azure Quickstart Templates gallery and search for Service Bus.


This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For Az module installation instructions, see Install Azure PowerShell.

What will you deploy?

With this template, you deploy a Service Bus namespace with a queue.

Service Bus queues offer First In, First Out (FIFO) message delivery to one or more competing consumers.

To run the deployment automatically, click the following button:

Deploy to Azure


With Azure Resource Manager, you define parameters for values you want to specify when the template is deployed. The template includes a section called Parameters that contains all of the parameter values. You should define a parameter for those values that will vary based on the project you are deploying or based on the environment you are deploying to. Do not define parameters for values that will always stay the same. Each parameter value is used in the template to define the resources that are deployed.

The template defines the following parameters.


The name of the Service Bus namespace to create.

"serviceBusNamespaceName": {
"type": "string",
"metadata": { 
    "description": "Name of the Service Bus namespace" 


The name of the queue created in the Service Bus namespace.

"serviceBusQueueName": {
"type": "string"


The Service Bus API version of the template.

"serviceBusApiVersion": { 
       "type": "string", 
       "defaultValue": "2017-04-01", 
       "metadata": { 
           "description": "Service Bus ApiVersion used by the template" 

Resources to deploy

Creates a standard Service Bus namespace of type Messaging, with a queue.

	"resources": [{
		"apiVersion": "2017-04-01",
		"name": "[parameters('serviceBusNamespaceName')]",
		"type": "Microsoft.ServiceBus/namespaces",
		"location": "[parameters('location')]",
		"sku": {
			"name": "Standard"
		"properties": {},
		"resources": [{
            "apiVersion": "[variables('sbVersion')]",
            "name": "[parameters('serviceBusQueueName')]",
            "type": "Queues",
            "dependsOn": [
                "[concat('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'))]"
            "properties": {
                "path": "[parameters('serviceBusQueueName')]"

For JSON syntax and properties, see namespaces and queues.

Commands to run deployment

To deploy the resources to Azure, you must be signed in to your Azure account and you must use the Azure Resource Manager module. To learn about using Azure Resource Manager with either Azure PowerShell or Azure CLI, see:

The following examples assume you already have a resource group in your account with the specified name.


New-AzResourceGroupDeployment -ResourceGroupName \<resource-group-name\> -TemplateFile <https://raw.githubusercontent.com/azure/azure-quickstart-templates/master/201-servicebus-create-queue/azuredeploy.json>

Azure CLI

azure config mode arm

azure group deployment create \<my-resource-group\> \<my-deployment-name\> --template-uri <https://raw.githubusercontent.com/azure/azure-quickstart-templates/master/201-servicebus-create-queue/azuredeploy.json>

Next steps

See the following topic that shows how to create an authorization rule for the namespace/queue: Create a Service Bus authorization rule for namespace and queue using an Azure Resource Manager template

Learn how to manage these resources by viewing these articles: