Blob存储数据的中央加密加密遥测数据主体

问题描述 投票:0回答:1

我在将遥测数据/ 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":"636988005747670551","contentEncoding":"","enqueuedTime":"2019-11-25T15:42:51.5340000Z"},"Body":"eyJ0ZW1wIjo3LjM5LCJodW0iOjczLjUsInJzc2kiOi04OSwic25yIjo4Ljh9"}

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

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

azure azure-storage-blobs azure-iot-hub azure-iot-central
1个回答
2
投票

查看this文档。

将设备消息系统属性,例如contentType设置为application / json,将contentEncoding设置为UTF-8

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

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

更新:

以下屏幕片段显示了将数据导出到Blob存储的快速测试示例。

  1. [使用分配给device1的PnP设备模板(environmentalSensor)创建IOT中央应用程序并将数据导出到Blob存储:

enter image description here

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

enter image description here

您可以看到,已发布的主题是

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

并且有6条消息已发送到IoT Central。

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

enter image description here

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

enter image description here

您可以看到,每条设备消息的正文都不是Base64编码的json文本。

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

© www.soinside.com 2019 - 2024. All rights reserved.