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

必要參數

--en --endpoint --endpoint-name

路由端點的名稱。 針對內建端點,請使用端點名稱 'events'。

--hub-name -n

IoT 中樞名稱。

--rn --route --route-name

路由的名稱。

--source-type --type -t

路由的來源。

接受的值: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents

選擇性參數

--condition -c

評估為套用路由規則的條件。

預設值: true
--enabled -e

布林值,指出是否啟用路由至IoT 中樞。

接受的值: false, true
預設值: True
--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --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}

必要參數

--hub-name -n

IoT 中樞名稱。

選擇性參數

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--rn --route --route-name

路由的名稱。

--source-type --type -t

路由的來源。

接受的值: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
--yes -y

略過使用者提示。 表示接受動作。 主要用於自動化案例。 預設:false。

接受的值: false, true
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --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

必要參數

--hub-name -n

IoT 中樞名稱。

選擇性參數

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--source-type --type -t

路由的來源。

接受的值: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --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}

必要參數

--hub-name -n

IoT 中樞名稱。

--rn --route --route-name

路由的名稱。

選擇性參數

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --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}

必要參數

--hub-name -n

IoT 中樞名稱。

選擇性參數

--ap --app-properties

路由訊息的應用程式屬性。

--body -b

路由訊息的本文。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--rn --route --route-name

路由的名稱。

--source-type --type -t

路由的來源。

接受的值: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
--sp --system-properties

路由訊息的系統屬性。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --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}

必要參數

--hub-name -n

IoT 中樞名稱。

--rn --route --route-name

路由的名稱。

選擇性參數

--condition -c

評估為套用路由規則的條件。

--en --endpoint --endpoint-name

路由端點的名稱。 針對內建端點,請使用端點名稱 'events'。

--enabled -e

布林值,指出是否啟用路由至IoT 中樞。

接受的值: false, true
--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--source-type --type -t

路由的來源。

接受的值: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。