New-AzureRmRouteConfig

Creates a route for a route table.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

New-AzureRmRouteConfig
   [-Name <String>]
   [-AddressPrefix <String>]
   [-NextHopType <String>]
   [-NextHopIpAddress <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzureRmRouteConfig cmdlet creates a route for an Azure route table.

Examples

Example 1: Create a route

PS C:\>$Route = New-AzureRmRouteConfig -Name "Route07" -AddressPrefix 10.1.0.0/16 -NextHopType "VnetLocal"
PS C:\> $Route
Name              : Route07
Id                : 
Etag              : 
ProvisioningState : 
AddressPrefix     : 10.1.0.0/16
NextHopType       : VnetLocal
NextHopIpAddress  :

The first command creates a route named Route07, and then stores it in the $Route variable. This route forwards packets to the local virtual network. The second command displays the properties of the route.

Parameters

-AddressPrefix

Specifies the destination, in Classless Interdomain Routing (CIDR) format, to which the route applies.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies a name for the route.

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

-NextHopIpAddress

Specifies the IP address of a virtual appliance that you add to your Azurevirtual network. This route forwards packets to that address. Specify this parameter only if you specify a value of VirtualAppliance for the NextHopType parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-NextHopType

Specifies how this route forwards packets. The acceptable values for this parameter are:

  • Internet. The default Internet gateway provided by Azure.
  • None. If you specify this value, the route does not forward packets.
  • VirtualAppliance. A virtual appliance that you add to your Azure virtual network.
  • VirtualNetworkGateway. An Azure server-to-server virtual private network gateway.
  • VnetLocal. The local virtual network. If you have two subnets, 10.1.0.0/16 and 10.2.0.0/16 in the same virtual network, select a value of VnetLocal for each subnet to forward to the other subnet.
Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Outputs

PSRoute