Add-AzIotHubRoute

Create a route in IoT Hub

Syntax

Add-AzIotHubRoute
   [-ResourceGroupName] <String>
   [-Name] <String>
   [-RouteName] <String>
   -Source <PSRoutingSource>
   -EndpointName <String>
   [-Condition <String>]
   [-Enabled]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzIotHubRoute
   [-InputObject] <PSIotHub>
   [-RouteName] <String>
   -Source <PSRoutingSource>
   -EndpointName <String>
   [-Condition <String>]
   [-Enabled]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzIotHubRoute
   [-ResourceId] <String>
   [-RouteName] <String>
   -Source <PSRoutingSource>
   -EndpointName <String>
   [-Condition <String>]
   [-Enabled]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

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

Examples

Example 1

PS C:\> Add-AzIotHubRoute -ResourceGroupName "myresourcegroup" -Name "myiothub" -RouteName R1 -Source DeviceMessages -EndpointName E1

RouteName     : R1
DataSource    : DeviceMessages
EndpointNames : E1
Condition     : 
IsEnabled     : False

Create a new route "R1".

Parameters

-Condition

Condition that is evaluated to apply the routing rule

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Enabled

Enable route

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EndpointName

Name of the routing endpoint

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

IotHub Object

Type:PSIotHub
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Name

Name of the Iot Hub

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Name of the Resource Group

Type:String
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceId

IotHub Resource Id

Type:String
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-RouteName

Name of the Route

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Source

Source of the route

Type:Microsoft.Azure.Commands.Management.IotHub.Models.PSRoutingSource
Accepted values:Invalid, DeviceMessages, TwinChangeEvents, DeviceLifecycleEvents, DeviceJobLifecycleEvents, DigitalTwinChangeEvents
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSIotHub

String

Outputs

Microsoft.Azure.Commands.Management.IotHub.Models.PSRouteMetadata