Skip to content

Latest commit

 

History

History
95 lines (62 loc) · 5 KB

service-bus-resource-manager-namespace.md

File metadata and controls

95 lines (62 loc) · 5 KB
title description author ms.topic ms.tgt_pltfrm ms.custom ms.date ms.author
Create an Azure Service Bus namespace using template
Use Azure Resource Manager template to create a Service Bus Messaging namespace
spelluru
article
dotnet
devx-track-arm-template
09/27/2021
spelluru

Create a Service Bus namespace by using an Azure Resource Manager template

Learn how to deploy an Azure Resource Manager template to create a Service Bus namespace. You can use this template for your own deployments, or customize it to meet your requirements. For more information about creating templates, see Azure Resource Manager documentation.

The following templates are also available for creating Service Bus namespaces:

[!INCLUDE updated-for-az]

If you don't have an Azure subscription, create a free account before you begin.

Create a service bus namespace

In this quickstart, you use an existing Resource Manager template from Azure Quickstart Templates:

[!code-jsoncreate-azure-service-bus-namespace]

To find more template samples, see Azure Quickstart Templates.

To create a service bus namespace by deploying a template:

  1. Select Try it from the following code block, and then follow the instructions to sign in to the Azure Cloud shell.

    $serviceBusNamespaceName = Read-Host -Prompt "Enter a name for the service bus namespace to be created"
    $location = Read-Host -Prompt "Enter the location (i.e. centralus)"
    $resourceGroupName = "${serviceBusNamespaceName}rg"
    $templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.servicebus/servicebus-create-namespace/azuredeploy.json"
    
    New-AzResourceGroup -Name $resourceGroupName -Location $location
    New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateUri -serviceBusNamespaceName $serviceBusNamespaceName
    
    Write-Host "Press [ENTER] to continue ..."
    

    The resource group name is the service bus namespace name with rg appended.

  2. Select Copy to copy the PowerShell script.

  3. Right-click the shell console, and then select Paste.

It takes a few moments to create an event hub.

Verify the deployment

To see the deployed service bus namespace, you can either open the resource group from the Azure portal, or use the following Azure PowerShell script. If the Cloud shell is still open, you don't need to copy/run the first and second lines of the following script.

$serviceBusNamespaceName = Read-Host -Prompt "Enter the same service bus namespace name used earlier"
$resourceGroupName = "${serviceBusNamespaceName}rg"

Get-AzServiceBusNamespace -ResourceGroupName $resourceGroupName -Name $serviceBusNamespaceName

Write-Host "Press [ENTER] to continue ..."

Azure PowerShell is used to deploy the template in this tutorial. For other template deployment methods, see:

Clean up resources

When the Azure resources are no longer needed, clean up the resources you deployed by deleting the resource group. If the Cloud shell is still open, you don't need to copy/run the first and second lines of the following script.

$serviceBusNamespaceName = Read-Host -Prompt "Enter the same service bus namespace name used earlier"
$resourceGroupName = "${serviceBusNamespaceName}rg"

Remove-AzResourceGroup -ResourceGroupName $resourceGroupName

Write-Host "Press [ENTER] to continue ..."

Next steps

In this article, you created a Service Bus namespace. See the other quickstarts to learn how to create queues, topics/subscriptions, and use them: