az iot hub message-route
注意
此參考是 Azure CLI 的 azure-iot 延伸模組的一部分 (2.37.0 版或更高版本)。 擴充功能會在您第一次執行 az iot hub message-route 命令時自動安裝。 深入了解擴充功能。
此命令群組處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
管理 IoT 中樞的路由。
命令
名稱 | Description | 類型 | 狀態 |
---|---|---|---|
az iot hub message-route create |
新增IoT 中樞的路由。 |
擴充 | 預覽版 |
az iot hub message-route delete |
刪除IoT 中樞中的所有路由或提及的路由。 |
擴充 | 預覽版 |
az iot hub message-route fallback |
管理 IoT 中樞的後援路由。 |
擴充 | 預覽版 |
az iot hub message-route fallback set |
啟用或停用IoT 中樞中的後援路由。 |
擴充 | 預覽版 |
az iot hub message-route fallback show |
顯示IoT 中樞的後援路由。 |
擴充 | 預覽版 |
az iot hub message-route list |
取得IoT 中樞中的所有路由。 |
擴充 | 預覽版 |
az iot hub message-route show |
取得IoT 中樞中路由的相關資訊。 |
擴充 | 預覽版 |
az iot hub message-route test |
在IoT 中樞中測試所有路由或提及的路由。 |
擴充 | 預覽版 |
az iot hub message-route update |
更新IoT 中樞的路由。 |
擴充 | 預覽版 |
az iot hub message-route create
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
新增IoT 中樞的路由。
az iot hub message-route create --en
--hub-name
--rn
--source-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 中樞名稱。
路由的名稱。
路由的來源。
選擇性參數
評估為套用路由規則的條件。
布林值,指出是否啟用路由至IoT 中樞。
資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>
。
全域參數
增加記錄詳細資訊,以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID
帳戶。
增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。
az iot hub message-route delete
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
刪除IoT 中樞中的所有路由或提及的路由。
az iot hub message-route delete --hub-name
[--resource-group]
[--rn]
[--source-type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
[--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 中樞名稱。
選擇性參數
資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>
。
路由的名稱。
路由的來源。
略過使用者提示。 表示接受動作。 主要用於自動化案例。 預設:false。
全域參數
增加記錄詳細資訊,以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID
帳戶。
增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。
az iot hub message-route list
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
取得IoT 中樞中的所有路由。
az iot hub message-route list --hub-name
[--resource-group]
[--source-type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
範例
從IoT 中樞取得所有路由。
az iot hub message-route list -n {iothub_name}
從IoT 中樞取得來源類型 「DeviceMessages」 的所有路由。
az iot hub message-route list -n {iothub_name} --source DeviceMessages
必要參數
IoT 中樞名稱。
選擇性參數
資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>
。
路由的來源。
全域參數
增加記錄詳細資訊,以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID
帳戶。
增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。
az iot hub message-route show
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
取得IoT 中樞中路由的相關資訊。
az iot hub message-route show --hub-name
--rn
[--resource-group]
範例
從IoT 中樞取得路由資訊。
az iot hub message-route show -n {iothub_name} --route-name {route_name}
必要參數
IoT 中樞名稱。
路由的名稱。
選擇性參數
資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>
。
全域參數
增加記錄詳細資訊,以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID
帳戶。
增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。
az iot hub message-route test
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
在IoT 中樞中測試所有路由或提及的路由。
您可以提供範例訊息來測試您的路由。
az iot hub message-route test --hub-name
[--ap]
[--body]
[--resource-group]
[--rn]
[--source-type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
[--sp]
範例
從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 中樞名稱。
選擇性參數
路由訊息的應用程式屬性。
路由訊息的本文。
資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>
。
路由的名稱。
路由的來源。
路由訊息的系統屬性。
全域參數
增加記錄詳細資訊,以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID
帳戶。
增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。
az iot hub message-route update
命令群組 'iot 中樞訊息路由' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus
更新IoT 中樞的路由。
您可以在路由上變更來源、端點、條件或啟用狀態。
az iot hub message-route update --hub-name
--rn
[--condition]
[--en]
[--enabled {false, true}]
[--resource-group]
[--source-type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
範例
更新路由至指定的端點和來源類型 「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}
必要參數
IoT 中樞名稱。
路由的名稱。
選擇性參數
評估為套用路由規則的條件。
路由端點的名稱。 針對內建端點,請使用端點名稱 'events'。
布林值,指出是否啟用路由至IoT 中樞。
資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>
。
路由的來源。
全域參數
增加記錄詳細資訊,以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID
帳戶。
增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應