Azure Iothub的事件中心兼容连接字符串

时间:2016-10-24 12:16:17

标签: azure templates azure-iot-hub

我正在尝试在ARM模板中获取与Event hub兼容的连接字符串,然后将其传递给我的HDInsight Cluster进行进一步处理。

我正在尝试创建我选择的事件中心连接字符串,但生成的事件中心名称不同,并且由我无法跟踪的源代码组成。

我需要列出并将事件中心连接字符串传递给模板中的HDInsight脚本操作。

iothub资源中的端点部分是我自定义事件集线器兼容连接字符串的地方。

"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 个答案:

答案 0 :(得分:3)

您无法为IoT Hub设置与Event Hub兼容的名称或与Event Hub兼容的端点的值,这些值是在创建集线器时生成的。但是,您可以在ARM模板中访问这些值。来自"输出"的以下片段创建IoT中心的模板部分说明了要使用的语法:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.user.fooddrug.NewsfeedFragment">

<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/photo_list">

</android.support.v7.widget.RecyclerView>


</RelativeLayout>