az iot hub message-route
Note
此參考是 Azure CLI 的 azure-iot 延伸模組的一部分 (2.67.0 版或更新版本)。 擴充功能會在您第一次執行 az iot hub message-route 命令時自動安裝。 深入了解擴充功能。
此命令群組處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
管理 IoT 中樞的路由。
命令
| 名稱 | Description | 類型 | 狀態 |
|---|---|---|---|
| az iot hub message-route create |
新增 IoT 中樞 的路由。 |
Extension | Preview |
| az iot hub message-route delete |
刪除 IoT 中樞 中的所有路由或提及的路由。 |
Extension | Preview |
| az iot hub message-route fallback |
管理IoT中樞的後援路由。 |
Extension | Preview |
| az iot hub message-route fallback set |
啟用或停用 IoT 中樞 中的後援路由。 |
Extension | Preview |
| az iot hub message-route fallback show |
顯示 IoT 中樞的後援路由。 |
Extension | Preview |
| az iot hub message-route list |
取得 IoT 中樞 中的所有路由。 |
Extension | Preview |
| az iot hub message-route show |
取得 IoT 中樞 中路由的相關信息。 |
Extension | Preview |
| az iot hub message-route test |
在 IoT 中樞 中測試所有路由或提及的路由。 |
Extension | Preview |
| az iot hub message-route update |
更新 IoT 中樞 的路由。 |
Extension | Preview |
az iot hub message-route create
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
新增 IoT 中樞 的路由。
az iot hub message-route create --en --endpoint --endpoint-name
--hub-name
--rn --route --route-name
--source-type --type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}
[--condition]
[--enabled {false, true}]
[--resource-group]
範例
使用指定的端點和來源類型 「DeviceMessages」 建立 IoT 中樞的路由。
az iot hub message-route create -n {iothub_name} --route-name {route_name} --endpoint-name {endpoint_name} --source DeviceMessages
使用內建端點和來源類型 「DeviceMessages」 建立 IoT 中樞的路由。
az iot hub message-route create -n {iothub_name} --route-name {route_name} --endpoint-name events --source DeviceMessages
使用指定的端點、來源類型 「DigitalTwinChangeEvents」 和自定義條件,建立 IoT 中樞的已停用路由。
az iot hub message-route create -n {iothub_name} --route-name {route_name} --endpoint-name {endpoint_name} --source DigitalTwinChangeEvents --condition {condition} --enabled false
必要參數
路由端點的名稱。 針對內建端點,請使用端點名稱 『events』。
IoT 中樞 名稱。
路由的名稱。
路由的來源。
| 屬性 | 值 |
|---|---|
| 接受的值: | deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents |
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
評估為套用路由規則的條件。
| 屬性 | 值 |
|---|---|
| 預設值: | true |
布爾值,指出是否要啟用IoT中樞的路由。
| 屬性 | 值 |
|---|---|
| 預設值: | True |
| 接受的值: | false, true |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az iot hub message-route delete
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
刪除 IoT 中樞 中的所有路由或提及的路由。
az iot hub message-route delete [--hub-name]
[--ids]
[--resource-group]
[--rn --route --route-name]
[--source-type --type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
[--subscription]
[--yes {false, true}]
範例
從 IoT 中樞刪除路由。
az iot hub message-route delete -n {iothub_name} --route-name {route_name}
從 IoT 中樞刪除來源類型 「DeviceMessages」 的所有路由。
az iot hub message-route delete -n {iothub_name} --source DeviceMessages
從 IoT 中樞刪除所有路由。
az iot hub message-route delete -n {iothub_name}
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
IoT 中樞 名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
路由的名稱。
路由的來源。
| 屬性 | 值 |
|---|---|
| 接受的值: | deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
略過使用者提示。 表示接受動作。 主要用於自動化案例。 預設:false。
| 屬性 | 值 |
|---|---|
| 接受的值: | false, true |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az iot hub message-route list
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
取得 IoT 中樞 中的所有路由。
az iot hub message-route list [--hub-name]
[--ids]
[--resource-group]
[--source-type --type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
[--subscription]
範例
從 IoT 中樞取得所有路由。
az iot hub message-route list -n {iothub_name}
從 IoT 中樞取得來源類型 「DeviceMessages」 的所有路由。
az iot hub message-route list -n {iothub_name} --source DeviceMessages
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
IoT 中樞 名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
路由的來源。
| 屬性 | 值 |
|---|---|
| 接受的值: | deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az iot hub message-route show
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
取得 IoT 中樞 中路由的相關信息。
az iot hub message-route show --rn --route --route-name
[--hub-name]
[--ids]
[--resource-group]
[--subscription]
範例
從IoT中樞取得路由資訊。
az iot hub message-route show -n {iothub_name} --route-name {route_name}
必要參數
路由的名稱。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
IoT 中樞 名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az iot hub message-route test
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
在 IoT 中樞 中測試所有路由或提及的路由。
您可以提供範例訊息來測試您的路由。
az iot hub message-route test [--ap --app-properties]
[--body]
[--hub-name]
[--ids]
[--resource-group]
[--rn --route --route-name]
[--source-type --type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
[--sp --system-properties]
[--subscription]
範例
測試來自IoT中樞的路由。
az iot hub message-route test -n {iothub_name} --route-name {route_name}
從 IoT 中樞測試來源類型 「DeviceMessages」 的所有路由。
az iot hub message-route test -n {iothub_name} --source DeviceMessages
使用自定義訊息測試來自IoT中樞的所有路由,包括本文、應用程式屬性和系統屬性。
az iot hub message-route test -n {iothub_name} -b {body} --ap {app_properties} --sp {system_properties}
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
路由訊息的應用程式屬性。
路由訊息的本文。
IoT 中樞 名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
路由的名稱。
路由的來源。
| 屬性 | 值 |
|---|---|
| 接受的值: | deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents |
路由訊息的系統屬性。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az iot hub message-route update
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
更新 IoT 中樞 的路由。
您可以在路由上變更來源、端點、條件或啟用狀態。
az iot hub message-route update --rn --route --route-name
[--condition]
[--en --endpoint --endpoint-name]
[--enabled {false, true}]
[--hub-name]
[--ids]
[--resource-group]
[--source-type --type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
[--subscription]
範例
更新路由至指定的端點和來源類型 「DeviceMessages」。。
az iot hub message-route update -n {iothub_name} --route-name {route_name} --endpoint-name {endpoint_name} --source DeviceMessages
停用路由。
az iot hub message-route update -n {iothub_name} --route-name {route_name} --enabled false
變更路由的條件。
az iot hub message-route update -n {iothub_name} --route-name {route_name} --condition {condition}
必要參數
路由的名稱。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
評估為套用路由規則的條件。
路由端點的名稱。 針對內建端點,請使用端點名稱 『events』。
布爾值,指出是否要啟用IoT中樞的路由。
| 屬性 | 值 |
|---|---|
| 接受的值: | false, true |
IoT 中樞 名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
路由的來源。
| 屬性 | 值 |
|---|---|
| 接受的值: | deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |