az iot hub message-route

Note

This reference is part of the azure-iot extension for the Azure CLI (version 2.46.0 or higher). The extension will automatically install the first time you run an az iot hub message-route command. Learn more about extensions.

This command group is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Manage routes of an IoT hub.

Commands

Name Description Type Status
az iot hub message-route create

Add a route for an IoT Hub.

Extension Preview
az iot hub message-route delete

Delete all routes or a mentioned route in an IoT Hub.

Extension Preview
az iot hub message-route fallback

Manage the fallback route of an IoT hub.

Extension Preview
az iot hub message-route fallback set

Enable or disable the fallback route in an IoT Hub.

Extension Preview
az iot hub message-route fallback show

Show the fallback route of an IoT Hub.

Extension Preview
az iot hub message-route list

Get all the routes in an IoT Hub.

Extension Preview
az iot hub message-route show

Get information about the route in an IoT Hub.

Extension Preview
az iot hub message-route test

Test all routes or a mentioned route in an IoT Hub.

Extension Preview
az iot hub message-route update

Update a route for an IoT Hub.

Extension Preview

az iot hub message-route create

Preview

Command group 'iot hub message-route' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Add a route for an IoT Hub.

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]

Examples

Create a route for an IoT Hub with the given endpoint and source type "DeviceMessages".

az iot hub message-route create -n {iothub_name} --route-name {route_name} --endpoint-name {endpoint_name} --source DeviceMessages

Create a route for an IoT Hub with the built-in endpoint and source type "DeviceMessages".

az iot hub message-route create -n {iothub_name} --route-name {route_name} --endpoint-name events --source DeviceMessages

Create a disabled route for an IoT Hub with the given endpoint, source type "DigitalTwinChangeEvents" and custom condition.

az iot hub message-route create -n {iothub_name} --route-name {route_name} --endpoint-name {endpoint_name} --source DigitalTwinChangeEvents --condition {condition} --enabled false

Required Parameters

--en --endpoint --endpoint-name

Name of the routing endpoint. For the built-in endpoint, use endpoint name 'events'.

--hub-name -n

IoT Hub name.

--rn --route --route-name

Name of the route.

--source-type --type -t

Source of the route.

Accepted values: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents

Optional Parameters

--condition -c

Condition that is evaluated to apply the routing rule.

Default value: true
--enabled -e

A boolean indicating whether to enable route to the IoT Hub.

Accepted values: false, true
Default value: True
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub message-route delete

Preview

Command group 'iot hub message-route' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Delete all routes or a mentioned route in an IoT Hub.

az iot hub message-route delete --hub-name
                                [--resource-group]
                                [--rn]
                                [--source-type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
                                [--yes {false, true}]

Examples

Delete a route from an IoT Hub.

az iot hub message-route delete -n {iothub_name} --route-name {route_name}

Delete all routes of source type "DeviceMessages" from an IoT Hub.

az iot hub message-route delete -n {iothub_name} --source DeviceMessages

Delete all routes from an IoT Hub.

az iot hub message-route delete -n {iothub_name}

Required Parameters

--hub-name -n

IoT Hub name.

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--rn --route --route-name

Name of the route.

--source-type --type -t

Source of the route.

Accepted values: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
--yes -y

Skip user prompts. Indicates acceptance of action. Used primarily for automation scenarios. Default: false.

Accepted values: false, true
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub message-route list

Preview

Command group 'iot hub message-route' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Get all the routes in an IoT Hub.

az iot hub message-route list --hub-name
                              [--resource-group]
                              [--source-type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]

Examples

Get all routes from an IoT Hub.

az iot hub message-route list -n {iothub_name}

Get all the routes of source type "DeviceMessages" from an IoT Hub.

az iot hub message-route list -n {iothub_name} --source DeviceMessages

Required Parameters

--hub-name -n

IoT Hub name.

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--source-type --type -t

Source of the route.

Accepted values: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub message-route show

Preview

Command group 'iot hub message-route' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Get information about the route in an IoT Hub.

az iot hub message-route show --hub-name
                              --rn
                              [--resource-group]

Examples

Get route information from an IoT Hub.

az iot hub message-route show -n {iothub_name} --route-name {route_name}

Required Parameters

--hub-name -n

IoT Hub name.

--rn --route --route-name

Name of the route.

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub message-route test

Preview

Command group 'iot hub message-route' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Test all routes or a mentioned route in an IoT Hub.

You can provide a sample message to test your routes.

az iot hub message-route test --hub-name
                              [--ap]
                              [--body]
                              [--resource-group]
                              [--rn]
                              [--source-type {deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
                              [--sp]

Examples

Test a route from an IoT Hub.

az iot hub message-route test -n {iothub_name} --route-name {route_name}

Test all routes of source type "DeviceMessages" from an IoT Hub.

az iot hub message-route test -n {iothub_name} --source DeviceMessages

Test all route from an IoT Hub with a custom message, including body, app properties, and system properties.

az iot hub message-route test -n {iothub_name} -b {body} --ap {app_properties} --sp {system_properties}

Required Parameters

--hub-name -n

IoT Hub name.

Optional Parameters

--ap --app-properties

App properties of the route message.

--body -b

Body of the route message.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--rn --route --route-name

Name of the route.

--source-type --type -t

Source of the route.

Accepted values: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
--sp --system-properties

System properties of the route message.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub message-route update

Preview

Command group 'iot hub message-route' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Update a route for an IoT Hub.

You can change the source, endpoint, condition, or enabled state on the route.

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}]

Examples

Update a route to a given endpoint and source type "DeviceMessages".

az iot hub message-route update -n {iothub_name} --route-name {route_name} --endpoint-name {endpoint_name} --source DeviceMessages

Disable a route.

az iot hub message-route update -n {iothub_name} --route-name {route_name} --enabled false

Change a route's condition.

az iot hub message-route update -n {iothub_name} --route-name {route_name} --condition {condition}

Required Parameters

--hub-name -n

IoT Hub name.

--rn --route --route-name

Name of the route.

Optional Parameters

--condition -c

Condition that is evaluated to apply the routing rule.

--en --endpoint --endpoint-name

Name of the routing endpoint. For the built-in endpoint, use endpoint name 'events'.

--enabled -e

A boolean indicating whether to enable route to the IoT Hub.

Accepted values: false, true
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--source-type --type -t

Source of the route.

Accepted values: deviceconnectionstateevents, devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.