< Back

Add-AzureRmRouteConfig

Tue Jan 29, 2019 9:53 pm

NAME Add-AzureRmRouteConfig



SYNOPSIS

Adds a route to a route table.





SYNTAX

Add-AzureRmRouteConfig [-AddressPrefix <String>] [-DefaultProfile <IAzureContextContainer>] [-Name <String>] [-NextHopIpAddress <String>]

[-NextHopType <String>] -RouteTable <PSRouteTable> [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Add-AzureRmRouteConfig cmdlet adds a route to an Azure route table.





PARAMETERS

-AddressPrefix <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Name <String>

Specifies a name of the route to add to the route table.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-NextHopIpAddress <String>

Specifies the IP address of a virtual appliance that you add to your Azure virtual network. This route forwards packets to that address.

Specify this parameter only if you specify a value of VirtualAppliance for the NextHopType parameter.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-NextHopType <String>

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.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-RouteTable <PSRouteTable>

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



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

PSRouteTable

Parameter 'RouteTable' accepts value of type 'PSRouteTable' from the pipeline





OUTPUTS

Microsoft.Azure.Commands.Network.Models.PSRouteTable







NOTES









Example 1: Add a route to a route table



PS C:\\>$RouteTable = Get-AzureRmRouteTable -ResourceGroupName "ResourceGroup11" -Name "RouteTable01"

PS C:\\> Add-AzureRmRouteConfig -Name "Route13" -AddressPrefix 10.3.0.0/16 -NextHopType "VnetLocal" -RouteTable $RouteTable



The first command gets a route table named RouteTable01 by using the Get-AzureRmRouteTable cmdlet. The command stores the table in the $RouteTable

variable.



The second command adds a route named Route13 to the route table stored in $RouteTable. This route forwards packets to the local virtual network.





Example 2: Add a route to a route table by using the pipeline



PS C:\\>Get-AzureRmRouteTable -ResourceGroupName "ResourceGroup11" -Name "RouteTable01" | Add-AzureRmRouteConfig -Name "Route02" -AddressPrefix

10.2.0.0/16 -NextHopType VnetLocal | Set-AzureRmRouteTable

Name : routetable01

ResourceGroupName : ResourceGroup11

Location : eastus

Id : /subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/ResourceGroup11/providers/Microsoft.Networ

k/routeTables/routetable01

Etag : W/"f13e1bc8-d41f-44d0-882d-b8b5a1134f59"

ProvisioningState : Succeeded

Tags :

Routes : [

{

"Name": "route07",

"Etag": "W/\\"f13e1bc8-d41f-44d0-882d-b8b5a1134f59\\"",

"Id": "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/ResourceGroup11/providers/Micro

soft.Network/routeTables/routetable01/routes/route07",

"AddressPrefix": "10.1.0.0/16",

"NextHopType": "VnetLocal",

"NextHopIpAddress": null,

"ProvisioningState": "Succeeded"

},

{

"Name": "route02",

"Etag": "W/\\"f13e1bc8-d41f-44d0-882d-b8b5a1134f59\\"",

"Id": "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/ResourceGroup11/providers/Micro

soft.Network/routeTables/routetable01/routes/route02",

"AddressPrefix": "10.2.0.0/16",

"NextHopType": "VnetLocal",

"NextHopIpAddress": null,

"ProvisioningState": "Succeeded"

},

{

"Name": "route13",

"Etag": null,

"Id": null,

"AddressPrefix": "10.3.0.0/16",

"NextHopType": "VnetLocal",

"NextHopIpAddress": null,

"ProvisioningState": null

}

]

Subnets : []



This command gets the route table named RouteTable01 by using Get-AzureRmRouteTable . The command passes that table to the current cmdlet by using

the pipeline operator. The current cmdlet adds the route named Route02, and then passes the result to the Set-AzureRmRouteTable cmdlet, which

updates the table to reflect your changes.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... outeconfig

Get-AzureRmRouteConfig

Get-AzureRmRouteTable

New-AzureRmRouteConfig

Remove-AzureRmRouteConfig

Set-AzureRmRouteConfig

Set-AzureRmRouteTable