2
votes

I am trying to fetch the Event hub compatible connection string in ARM template and then pass it on to my HDInsight Cluster for further processing.

I am trying to create the event hub connectiong string of my choice, But the event hub name generated is not the same and consists of a guid whose source I am unable to track.

I need the to list and pass the event hub connection string to HDInsight script action within the template.

The endpoint part in the iothub resource is where I customize the event hub compatible connection string.

"resources": [
        {            
            "type": "Microsoft.Devices/IotHubs",
            "sku": {
                "name": "S1",
                "tier": "Standard",
                "capacity": 1
            },
            "name": "[variables('IotHub')]",
            "apiVersion": "2016-02-03",
            "location": "southeastasia",
            "tags": {},
            "properties": {
                "ipFilterRules": [],
                "eventHubEndpoints": {
                    "events": {
                        "retentionTimeInDays": 4,
                        "partitionCount": 4,
                        "partitionIds": [
                            "0",
                            "1",
                            "2",
                            "3"
                        ],
                        "path": "[variables('IotHub')]",
                        "endpoint": "[concat('sb://', variables('IotHub'),'.servicebus.windows.net/')]"
                    }                 
                },
                "storageEndpoints": {
                    "$default": {
                        "sasTtlAsIso8601": "PT1H",
                        "connectionString": "",
                        "containerName": ""
                    }
                },
                "enableFileUploadNotifications": false,
                "cloudToDevice": {
                    "maxDeliveryCount": 10,
                    "defaultTtlAsIso8601": "PT1H",
                    "feedback": {
                        "lockDurationAsIso8601": "PT1M",
                        "ttlAsIso8601": "PT1H",
                        "maxDeliveryCount": 10
                    }
                },
                "operationsMonitoringProperties": {
                    "events": {
                        "None": "None",
                        "Connections": "None",
                        "DeviceTelemetry": "None",
                        "C2DCommands": "None",
                        "DeviceIdentityOperations": "None",
                        "FileUploadOperations": "None"
                    }
                },
                "features": "None"
            },
            "resources": [],
            "dependsOn": []
        }
    ],
1
Welcome to Stack Overflow! You can read up on how to How to Ask a question and create a minimal reproducible example. That makes it easier for us to help you.Katie
IoT Hub and Event Hub are two different Azure services. It's not clear what you're asking.CSharpRocks
Azure's Iot Hub has a event hub compatible connection string available to be used with applications working with event hub conn. strings. I am trying to customize the created event hub connection string in the iothub service.Gajinder Singh
Did you create the connection string in ARM template with JSON type? Would you might show your code lines of creating the connection string in your JSON file?Rita Han

1 Answers

4
votes

You can't set the values for the Event Hub-compatible name or Event Hub-compatible endpoint for an IoT Hub, these values are generated when the hub is created. However, you can access these values in an ARM template. The following snippet from the "outputs" section of a template that creates an IoT hub illustrates the syntax to use:

"outputs": {
  "eventHubCompatibleEndpoint": {
    "type": "string",
    "value": "[reference(resourceId('Microsoft.Devices/IoTHubs',parameters('hubName'))).eventHubEndpoints.events.endpoint]"
  },
  "eventHubCompatibleName": {
    "type": "string",
    "value": "[reference(resourceId('Microsoft.Devices/IoTHubs',parameters('hubName'))).eventHubEndpoints.events.path]"
  }
}