【问题标题】:Iot Central to Blob Storage Data encrypted telemetry data bodyIoT Central 到 Blob 存储数据加密遥测数据主体
【发布时间】:2019-11-27 08:15:37
【问题描述】:

我在将遥测数据/json 保存到 blob 存储时遇到了问题。 问题是保存的数据已经加密了我宝贵的遥测数据。

{"EnqueuedTimeUtc":"2019-11-25T15:42:51.5340000Z","Properties":{},"SystemProperties":{"to":"/devices/device-08/messages/events","connectionDeviceId":"device-08","connectionAuthMethod":"{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}","connectionDeviceGenerationId":"xxxxxxxxxxxxx","contentEncoding":"","enqueuedTime":"2019-11-25T15:42:51.5340000Z"},"Body":"eyJ0ZW1wIjo3LjM5LCJodW0iOjczLjUsInJzc2kiOi04OSwic25yIjo4Ljh9"}

我认为问题也在于“contentEncoding”:“”,因为它应该是“contentEncoding”:“utf-8”。

有谁知道如何解决这个问题 :) 非常感谢您的努力!

【问题讨论】:

    标签: azure azure-blob-storage azure-iot-hub azure-iot-central


    【解决方案1】:

    查看this 文档。

    contentType等设备消息系统属性设置为application/jsoncontentEncoding设置为UTF-8.

    如果您的设备直接使用MQTT协议,请使用主题传递系统属性,例如:

     devices/mydeviceId/messages/events/$.ct=application%2Fjson&$.ce=utf-8
    

    更新:

    以下屏幕 sn-ps 显示了将数据导出到 blob 存储的快速测试示例。

    1. 使用分配给 device1 的 PnP 设备模板 (environmentalSensor) 和数据导出到 blob 存储创建 IOT Central 应用程序:

    1. 使用 Azure IoT Hub 测试器模拟通过 MQTT 协议直接连接到 IoT Central 的 PnP 设备1:

    如您所见,发布的主题是

    devices/device1/messages/events/$.ct=application%2Fjson&$.ce=utf-8
    

    6 条消息已发送到 IoT Central。

    1. 在 IoT Central 仪表板上显示遥测数据。

    1. 使用 Azure 存储资源管理器探索 blob 内容:

    如您所见,每条设备消息的正文都不是 Base64 编码的 json 文本。

    请注意,只有设备消息的 contentTypecontentEncoding 将决定正文是否为 Base64 编码。

    【讨论】:

    • 感谢您的回答。困扰我的设备不是我自己设置的。我的设备没有遇到这个问题。我不知道在哪里更改参数。这是设备问题还是 Azure 服务问题?
    • 查看我的更新。您确定您的设备发送了带有系统属性 contentType=application/jsoncontentEncoding=utf-8 的遥测消息吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多