0

In order to receive Azure IotHub Device Twin change notifications, it appears that it's necessary to create a custom endpoint and create a route to send notifications to that endpoint. This seems straightforward enough on the Azure Portal, but as one might expect we want to automate it.

I haven't been able to find any documentation for the the az cli or even the REST API, though I might have missed something. I didn't find anything promising looking in the SDKs either.

How do I automate adding a custom endpoint and then setting up the route for device twin notifications?

cacsar
  • 2,098
  • 1
  • 14
  • 27

1 Answers1

0

You can check IotHubs template to see if it helps.

Route:

"routing": {
  "endpoints": {
    "serviceBusQueues": [
      {
        "connectionString": "string",
        "name": "string",
        "subscriptionId": "string",
        "resourceGroup": "string"
      }
    ]
  },
  "routes": [
    {
      "name": "string",
      "source": "string",
      "condition": "string",
      "endpointNames": [
        "string"
      ],
      "isEnabled": boolean
    }
  ],

Consumer group:

  {
    "apiVersion": "2016-02-03",
    "type": "Microsoft.Devices/IotHubs/eventhubEndpoints/ConsumerGroups",
    "name": "[concat(parameters('hubName'), '/events/cg1')]",
    "dependsOn": [
      "[concat('Microsoft.Devices/Iothubs/', parameters('hubName'))]"
    ]
  },

For more detailed information you can reference:

Microsoft.Devices/IotHubs template reference

Create an IoT hub using Azure Resource Manager template (PowerShell)

Rita Han
  • 9,574
  • 1
  • 11
  • 24