Edit

Share via


Set-AzureRoute

Creates a route in a route table.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Default (Default)

Set-AzureRoute
    -RouteName <String>
    -AddressPrefix <String>
    -NextHopType <String>
    [-NextHopIpAddress <String>]
    -RouteTable <IRouteTable>
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

Description

The Set-AzureRoute cmdlet creates a route in a route table. The new route takes effect almost immediately on the virtual machines that are associated with the route table.

Examples

Example 1: Add a virtual appliance next hop route

PS C:\> New-AzureRouteTable -Name "ApplianceRouteTable" -Location "Central US" -Label "Appliance Route Table" | Set-AzureRoute -RouteName "ApplianceRoute03" -AddressPrefix "10.0.0.0/24" -NextHopType VirtualAppliance -NextHopIpAddress "10.0.1.5"

Routes                        Name                          Location                      Label
------                        ----                          --------                      -----
{approute}                    AppRT                         Central US                    Appliance Route Table

This command creates a route table named ApplianceRouteTable in the specified ___location. The command passes that route table to the current cmdlet. The current cmdlet adds a route named ApplianceRoute03, which is a VirtualAppliance next hop type. The command specifies the next hop IP address and the address prefix for the route.

Example 2: Add an Internet next hop route

PS C:\> Get-AzureRouteTable -Name "ApplianceRouteTable" | Set-AzureRoute -RouteName "InternetRoute" -AddressPrefix "0.0.0.0/0" -NextHopType Internet

Routes                        Name                          Location                      Label
------                        ----                          --------                      -----
{approute, internetroute}     AppRT                         Central US                    Appliance Route Table

This command gets a route table named ApplianceRouteTable. The command passes that route table to the current cmdlet. The current cmdlet adds a route named InternetRoute, which is an Internet next hop type. The command specifies the address prefix for the route.

Parameters

-AddressPrefix

Specifies an address prefix for the new route.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NextHopIpAddress

Specifies the IP address of the appliance that is the next hop for traffic that uses this route. Specify this value only if you specify a value of VirtualAppliance for the NextHopType parameter.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NextHopType

Specifies the next hop type for traffic that uses this route. Valid values are:

  • VPNGateway
  • VNETLocal
  • Internet
  • VirtualAppliance
  • Null

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RouteName

Specifies a name for the new route that this cmdlet adds.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RouteTable

Specifies the route table to which this cmdlet adds the new route.

Parameter properties

Type:IRouteTable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.