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
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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NextHopType
Specifies the next hop type for traffic that uses this route. Valid values are:
- VPNGateway
- VNETLocal
- Internet
- VirtualAppliance
- Null
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | AzureSMProfile |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RouteName
Specifies a name for the new route that this cmdlet adds.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RouteTable
Specifies the route table to which this cmdlet adds the new route.
Type: | IRouteTable |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |