az iot hub message-route
Note
此参考是 Azure CLI(版本 2.67.0 或更高版本)的 azure-iot 扩展的一部分。 该扩展将在首次运行 az iot hub message-route 命令时自动安装。 了解更多关于扩展的信息。
此命令组处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
管理 IoT 中心的路由。
命令
| 名称 | 说明 | 类型 | Status |
|---|---|---|---|
| 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/。
订阅的名称或 ID。 可以使用 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 |
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
路由的名称。
路由的源。
| 属性 | 值 |
|---|---|
| 接受的值: | deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents |
订阅的名称或 ID。 可以使用 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 |
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
路由的源。
| 属性 | 值 |
|---|---|
| 接受的值: | deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents |
订阅的名称或 ID。 可以使用 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 |
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
订阅的名称或 ID。 可以使用 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 |
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
路由的名称。
路由的源。
| 属性 | 值 |
|---|---|
| 接受的值: | deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents |
路由消息的系统属性。
订阅的名称或 ID。 可以使用 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 |
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
路由的源。
| 属性 | 值 |
|---|---|
| 接受的值: | deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents |
订阅的名称或 ID。 可以使用 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 |