Skip to main content

Cloud

Azure ARM Template: Create Service Bus Namespaces

The Visual Studio 2015 support GUI support for Azure Resource Group projects and managing ARM Templates is still fairly new. As a result there isn’t full GUI and editor support in it for all features of Azure; although there are a lot of features already supported. One of the features that isn’t supported through the GUI yet is Azure Service Bus Namespaces. Since Azure Resource Manager and ARM Templates are fairly new as well, the official documentation from Microsoft isn’t full of how to do anything yet. This is also true when it comes to Azure Service Bus Namespaces. So, this article will explain, starting from a blank Azure Resource Group project, how to add what is necessary for deploying / managing Azure Service Bus Namespaces.
If you’re not familiar with Azure ARM Templates or the Azure Resource Group project type in Visual Studio, then you’ll likely want to check out the following previous articles in this series on ARM Templates:

Define Azure Service Bus Namespace within ARM Template

This article will cover the simplest way to setup an ARM Template for creating an Azure Service Bus Namespace within Microsoft Azure. As a result, instead of starting with the project generated in a previous article, this article will start by creating a new Azure Resource Group project using the Blank Template. This will keeps things simpler and cleaner when describing what needs to be added and modified to deploy out an Azure Service Bus Namespace.
To setup an ARM Template to deploy an Azure Service Bus Namespace within Visual Studio, follow the below steps:

  1. Create new Azure Resource Group project in Visual Studio 2015AzureARMServiceBusNamespace001
  2. Select the “Blank Template”, then click “Ok”AzureARMServiceBusNamespace002
  3. Modify the generated “blank” ARM Template (the “azuredeploy.json” file) to match the following example.
{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
  },
  "variables": {
  },
  "resources": [
    {
      "apiVersion": "2015-08-01",
      "name": "SuperSBNamespace",
      "type": "Microsoft.ServiceBus/namespaces",
      "location": "[resourceGroup().location]",
      "properties": {
        "messagingSku": "1"
      },
      "resources": [
      ]
    }
  ],
  "outputs": {
  }
}

As shown in the above ARM Template, the JSON block that’s necessary for defining an Azure Service Bus Namespace goes within the “resources” array of the ARM Template. This block of JSON is similar to defining any other Azure service, but with the “type” set to “Microsoft.ServiceBus/namespaces” to specify the resource to be deployed is an Azure Service Bus Namespace.
It’s important to know that the Name of the Azure Service Bus Namespace is declared within the “name” property on the JSON; in the above example it’s hard coded to “SuperSBNamespace”. The name that’s used for the Namespace can be dynamically set using an ARM Template Parameter. This article will not get into the specifics of defining and using ARM Template Parameters, however, it is covered in the following, previous articles in this series:

If you look for Azure Service Bus Namespace support within the Visual Studio GUI, you wont currently find any. The current version of the tools (at the time of this writing) does not support defining or deploying Service Bus Namespaces. However, since it is technically supported within ARM Templates and Azure, you can still define them as shown above and they will get provisioned / deployed when deploying an ARM Template into Azure.

Azure Service Bus and Resource Groups

Previously, when provisioning Azure Service Bus Namespaces using either the Classic Portal or .NET SDK there was not a method to assign it to a Resource Group. The functionality provided by Azure and ARM Templates does support Resource Groups for Azure Service Bus Namespaces. While only the Classic Portal supports managing Service Bus features currently, you will see them listed within the Resource Group when viewing it within the Current Azure Portal.
Currently, it looks like ARM Templates are the only way to assign an Azure Service Bus Namespace to be within a specific Resource Group.

Conclusion

For the purpose of clarity and brevity, this article has kept things very simple. So rather than build on previous articles in this series, this article pretty much stands on its own. However, you can certainly use what’s explained in this article to combine Azure Service Bus Namespace management into your new or existing ARM Templates. The next article in this series will continue from this article to cover how to create an Azure Service Bus Topic with a basic Subscription to catch all messages.

Tags

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Chris Pietschmann

Chris is an Azure Solutions Architect with more than 14 years of experience building Enterprise systems using a wide array of Microsoft technologies, including Bing Maps and the Microsoft Azure cloud. He has been a 5 time recipient of the Microsoft MVP award. Chris has successfully implemented numerous Enterprise solutions on the Microsoft Azure Cloud Platform since its initial release all the way back in 2010.

More from this Author

Categories
Follow Us