共用方式為


IoT 中樞裝置更新的組態檔

裝置更新代理程式會從裝置上的 du-config.json 檔案取得其設定資訊。 代理程式會讀取這些值,並將其報告給裝置更新服務:

  • 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 程式的使用者清單。 請注意,du-shell 是一種訊息代理程式,會以 'root' 身分執行多種更新動作。 裝置更新預設內容更新處理常式會叫用 du-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": "")。
製造商 由裝置更新代理程式回報為 DeviceInformation 介面的一部分。
機型 由裝置更新代理程式回報為 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"
      }
    }
  ]
}