你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Device Update for IoT Hub 配置文件

Device Update 代理从设备上的 du-config.json 文件中获取其配置信息。 代理读取这些值并将其报告给 Device Update 服务:

  • AzureDeviceUpdateCore:4.ClientMetadata:4.deviceProperties["manufacturer"]
  • AzureDeviceUpdateCore:4.ClientMetadata:4.deviceProperties["model"]
  • DeviceInformation.manufacturer
  • DeviceInformation.model
  • additionalProperties
  • connectionData
  • connectionType

文件位置

在使用 Linux OS 的 IoT 设备上安装 Debian 代理时,请修改 /etc/adu/du-config.json 文件以更新值。 对于 Yocto 生成系统,在名为 adu 的分区或磁盘中创建一个名为 /adu/du-config.json 的 json 文件。

字段列表

名称 说明
schemaVersion 映射当前配置文件格式版本的架构版本。
aduShellTrustedUsers 可以启动 adu-shell 程序的用户的列表。 请注意,adu-shell 是一个执行“根”等多种更新操作的中转程序。 设备更新默认内容更新处理程序会调用 adu-shell 来执行需要超级用户权限的任务。 需要此特权的任务示例包括 apt-get install 或执行特权脚本。
aduc_manufacturer 由 AzureDeviceUpdateCore:4.ClientMetadata:4 接口报告,用于对设备进行分类来确定更新部署的目标。
aduc_model 由 AzureDeviceUpdateCore:4.ClientMetadata:4 接口报告,用于对设备进行分类来确定更新部署的目标。
iotHubProtocol 接受的值为 mqttmqtt/ws,用于更改用于与 IoT 中心连接的协议。 默认值为“mqtt”
compatPropertyNames 这些属性用于检查设备兼容性,以更新部署为目标。 对于指定用于兼容性的所有属性,值只能采用小写形式
additionalProperties 可选字段。 可以设置设备报告的其他属性并将这些属性用于兼容性检查。 限制为五个设备属性。 这些属性只应采用小写形式。
connectionType 接受的值为 stringAIS。 将设备手动连接到 IoT 中心以便进行测试时,使用 string。 对于生产方案,在使用 IoT 标识服务将设备连接到 IoT 中心时使用 AIS。 有关详细信息,请参阅了解 IoT 标识服务配置
connectionData 如果 connectionType = "string",请在此处添加 IoT 设备的设备或模块连接字符串。 如果 connectionType = "AIS",请将 connectionData 设置为空字符串 ("connectionData": "")。
制造商 由 Device Update 代理报告为 DeviceInformation 接口的一部分。
模型 由 Device Update 代理报告为 DeviceInformation 接口的一部分。

示例:“du-config.json”文件内容


{
  "schemaVersion": "1.1",
  "aduShellTrustedUsers": [
    "adu",
    "do"
  ],
  "iotHubProtocol": "mqtt",
  "compatPropertyNames":"manufacturer,model,location,language" <The property values must be in lower case only>,
  "manufacturer": <Place your device info manufacturer here>,
  "model": <Place your device info model here>,
  "agents": [
    {
      "name": <Place your agent name here>,
      "runas": "adu",
      "connectionSource": {
        "connectionType": "string", //or “AIS”
        "connectionData": <Place your Azure IoT device connection string here>
      },
      "manufacturer": <Place your device property manufacturer here>,
      "model": <Place your device property model here>,
      "additionalDeviceProperties": {
        "location": "usa",
        "environment": "development"
      }
    }
  ]
}