az iot hub route

Manage routes of an IoT hub.

Commands

az iot hub route create

Create a route in IoT Hub.

az iot hub route delete

Delete all or mentioned route for your IoT Hub.

az iot hub route list

Get all the routes in IoT Hub.

az iot hub route show

Get information about the route in IoT Hub.

az iot hub route test

Test all routes or mentioned route in IoT Hub.

az iot hub route update

Update a route in IoT Hub.

az iot hub route create

Create a route in IoT Hub.

Create a route to send specific data source and condition to a desired endpoint.

az iot hub route create --en
                        --hub-name
                        --name
                        --source {devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}
                        [--condition]
                        [--enabled {false, true}]
                        [--resource-group]
                        [--subscription]

Examples

Create a new route "R1".

az iot hub route create -g MyResourceGroup --hub-name MyIotHub --endpoint-name E2 --source-type DeviceMessages --route-name R1

Create a new route "R1" with all parameters.

az iot hub route create -g MyResourceGroup --hub-name MyIotHub --endpoint-name E2 --source-type DeviceMessages --route-name R1 --condition true --enabled true

Required Parameters

--en --endpoint --endpoint-name

Name of the routing endpoint.

--hub-name

IoT Hub name.

--name --route-name -n

Name of the Route.

--source --source-type --type -s

Source of the route.

accepted values: devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents

Optional Parameters

--condition -c

Condition that is evaluated to apply the routing rule.

--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>.

--subscription

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

az iot hub route delete

Delete all or mentioned route for your IoT Hub.

Delete a route or all routes for your IoT Hub.

az iot hub route delete [--hub-name]
                        [--ids]
                        [--name]
                        [--resource-group]
                        [--source {devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
                        [--subscription]

Examples

Delete route "R1" from "MyIotHub" IoT Hub.

az iot hub route delete -g MyResourceGroup --hub-name MyIotHub --route-name R1

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

az iot hub route delete -g MyResourceGroup --hub-name MyIotHub --source-type DeviceMessages

Delete all the routes from "MyIotHub" IoT Hub.

az iot hub route delete -g MyResourceGroup --hub-name MyIotHub

Optional Parameters

--hub-name

IoT Hub name.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name --route-name -n

Name of the Route.

--resource-group -g

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

--source --source-type --type -s

Source of the route.

accepted values: devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
--subscription

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

az iot hub route list

Get all the routes in IoT Hub.

Get information on all routes from an IoT Hub.

az iot hub route list [--hub-name]
                      [--ids]
                      [--query-examples]
                      [--resource-group]
                      [--source {devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
                      [--subscription]

Examples

Get all route from "MyIotHub" IoT Hub.

az iot hub route list -g MyResourceGroup --hub-name MyIotHub

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

az iot hub route list -g MyResourceGroup --hub-name MyIotHub --source-type DeviceMessages

Optional Parameters

--hub-name

IoT Hub name.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

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

--source --source-type --type -s

Source of the route.

accepted values: devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
--subscription

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

az iot hub route show

Get information about the route in IoT Hub.

Get information on a specific route in your IoT Hub.

az iot hub route show --name
                      [--hub-name]
                      [--ids]
                      [--query-examples]
                      [--resource-group]
                      [--subscription]

Examples

Get an route information from "MyIotHub" IoT Hub.

az iot hub route show -g MyResourceGroup --hub-name MyIotHub --route-name {routeName}

Required Parameters

--name --route-name -n

Name of the Route.

Optional Parameters

--hub-name

IoT Hub name.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

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

--subscription

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

az iot hub route test

Test all routes or mentioned route in IoT Hub.

Test all existing routes or mentioned route in your IoT Hub. You can provide a sample message to test your routes.

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

Examples

Test the route "R1" from "MyIotHub" IoT Hub.

az iot hub route test -g MyResourceGroup --hub-name MyIotHub --route-name R1

Test all the route of source type "DeviceMessages" from "MyIotHub" IoT Hub.

az iot hub route test -g MyResourceGroup --hub-name MyIotHub --source-type DeviceMessages

Optional Parameters

--ap --app-properties

App properties of the route message.

--body -b

Body of the route message.

--hub-name

IoT Hub name.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name --route-name -n

Name of the Route.

--resource-group -g

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

--source --source-type --type -s

Source of the route.

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

System properties of the route message.

--subscription

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

az iot hub route update

Update a route in IoT Hub.

Updates a route in IoT Hub. You can change the source, enpoint or query on the route.

az iot hub route update --name
                        [--condition]
                        [--en]
                        [--enabled {false, true}]
                        [--hub-name]
                        [--ids]
                        [--resource-group]
                        [--source {devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents}]
                        [--subscription]

Examples

Update source type of route "R1" from "MyIotHub" IoT Hub.

az iot hub route update -g MyResourceGroup --hub-name MyIotHub --source-type DeviceMessages --route-name R1

Required Parameters

--name --route-name -n

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.

--enabled -e

A boolean indicating whether to enable route to the Iot hub.

accepted values: false, true
--hub-name

IoT Hub name.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--resource-group -g

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

--source --source-type --type -s

Source of the route.

accepted values: devicejoblifecycleevents, devicelifecycleevents, devicemessages, digitaltwinchangeevents, invalid, twinchangeevents
--subscription

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