Deploy an Azure Service Bus Topic Using ARM Template

Utilize an ARM Template to Deploy an Azure Service Bus Topic through the 'Deploy a Custom Template' method.

Login to Azure

Upon logging into Azure, locate the 'Deploy a Custom Template' option and proceed to open it.

Custom Deployment

Click on Build your own template in the editor.

Build your own template in editor

Create a json file with below code.

Example. AzureDeploy.json

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "serviceBusNamespaceName": {
            "type": "string",
            "metadata": {
                "description": "Name of the Service Bus Namespace"
            }
        },
        "serviceBusTopicName": {
            "type": "string",
            "metadata": {
                "description": "Name of the Service Bus Topic"
            }
        },
        "serviceBusTopicSubscriptionName": {
            "type": "string",
            "metadata": {
                "description": "Name of the Service Bus Topic Subscription"
            }
        }
    },
    "variables": {
        "sbVersion": "2015-08-01"
    },
    "resources": [
        {
            "apiVersion": "[variables('sbVersion')]",
            "name": "[parameters('serviceBusNamespaceName')]",
            "type": "Microsoft.ServiceBus/namespaces",
            "location": "[resourceGroup().location]",
            "properties": {},
            "resources": [
                {
                    "apiVersion": "[variables('sbVersion')]",
                    "name": "[parameters('serviceBusTopicName')]",
                    "type": "Topics",
                    "dependsOn": [
                        "[concat('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'))]"
                    ],
                    "properties": {
                        "path": "[parameters('serviceBusTopicName')]"
                    },
                    "resources": [
                        {
                            "apiVersion": "[variables('sbVersion')]",
                            "name": "[parameters('serviceBusTopicSubscriptionName')]",
                            "type": "Subscriptions",
                            "dependsOn": [
                                "[parameters('serviceBusTopicName')]"
                            ],
                            "properties": {},
                            "resources": []
                        }
                    ]
                }
            ]
        }
    ],
    "outputs": {}
}

Click on Load file and upload above created json file AzureDeploy.json.

As seen below.

Edit template

Upload file

After Uploaded file click on Save button

Create Another json file

Example. AzureDeploy-Dev.Parameters.json

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "environment": {
            "value": "dev"
        },
        "resourceGroupIndex": {
            "value": "003"
        },
        "resourceGroupName": {
            "value": "Demo"
        },
        "serviceBusNamespaceName": {
            "value": "testapy003"
        },
        "serviceBusTopicName": {
            "value": "apytest-003"
        },
        "serviceBusTopicSubscriptionName": {
            "value": "apysubName"
        }
    }
}

After creating a json file.

Click on Edit parameters button as seen below:

Custom Development

Open file

After uploading the file seen below.

Click on Review + Create button

Create Custom development

Select the "Create" button, and after a short duration, observe the successful creation of Azure Service Bus as displayed below.

Service Bus