DEV Community

Cover image for Azure ARM: Create Event Grid with Service Bus Queue Subscription
Markus Meyer
Markus Meyer

Posted on • Originally published at markusmeyer.hashnode.dev

4 1

Azure ARM: Create Event Grid with Service Bus Queue Subscription

Create an Event Grid Custom Topic and Service Bus Queue Subscription on Azure with ARM Template

Table of Contents

1 Objective

2 ARM Template

3 Deployment

4 Event Grid in Azure Portal

1 Objective

Messages have to be distributed to different receivers asynchronously.

Azure Event Grid Topic receives the message and the Azure Event Grid Subscription forwards it to Azure Service Bus Queue.

Sequence Diagram

2 ARM Template

The Azure ARM Template creates an Event Grid Topic with a dependency to the Service Bus.
Please find a detailed description at Microsoft.EventGrid topics template reference.

{
  "name": "[parameters('eventGridTopicName')]",
  "type": "Microsoft.EventGrid/topics",
  "location": "[parameters('location')]",
  "apiVersion": "2020-06-01",
  "dependsOn": [
    "[resourceId('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'))]"
  ]
}
Enter fullscreen mode Exit fullscreen mode

The following extract creates the Event Grid Subscription with the ServiceBusQueue
endpoint. Please find a detailed description at Microsoft.EventGrid eventSubscriptions template reference.

{
  "type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
  "name": "[concat(parameters('eventGridTopicName'), '/Microsoft.EventGrid/', parameters('eventGridSubscriptionName'))]",
  "apiVersion": "2020-01-01-preview",
  "location": "[parameters('location')]",
  "dependsOn": [
    "[resourceId('Microsoft.EventGrid/topics/', parameters('eventGridTopicName'))]"
  ],
  "properties": {
    "destination": {
      "endpointType": "ServiceBusQueue",
      "properties": {
        "resourceId": "[resourceId('Microsoft.ServiceBus/namespaces/queues/', parameters('serviceBusNamespaceName'),  parameters('serviceBusQueueName'))]"
      }
    },
    "eventDeliverySchema": "EventGridSchema",
    "filter": {
      "isSubjectCaseSensitive": false
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

The complete ARM Template can be found in the GitHub Azure
/
azure-quickstart-templates
.

3 Deployment

Azure CLI:

az deployment group create --resource-group "EvalGrid" --name grid  --template-file .\azuredeploy.json --parameters "@azuredeploy.parameters.json"
Enter fullscreen mode Exit fullscreen mode

Deploy To Azure

4 Event Grid in Azure Portal

The Event Grid can found in Azure Portal.

grid-queue.png

Retry later

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Retry later