Set-AzIotHubRoute

Update a route in IoT Hub

Syntax

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

Description

Edit a route. You can update all the fields in a route including the data source, endpoint, routing query and also enable or disable the route.

Examples

Example 1

PS C:\> Set-AzIotHubRoute -ResourceGroupName "myresourcegroup" -Name "myiothub" -RouteName R1 -Source TwinChangeEvents 

RouteName     : R1
DataSource    : TwinChangeEvents
EndpointNames : events
Condition     : true
IsEnabled     : False

Updating the route information.

Example 2

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

RouteName     : R1
DataSource    : TwinChangeEvents
EndpointNames : E1
Condition     : true
IsEnabled     : False

Updating the route information.

Example 3

PS C:\> Set-AzIotHubRoute -ResourceGroupName "myresourcegroup" -Name "myiothub" -RouteName R1 -Enabled

RouteName     : R1
DataSource    : TwinChangeEvents
EndpointNames : E1
Condition     : true
IsEnabled     : True

Updating the route information.

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:Nullable<T>[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