Set-AzRouteConfig
Updates a route configuration for a route table.
Syntax
Set-AzRouteConfig
-RouteTable <PSRouteTable>
[-Name <String>]
[-AddressPrefix <String>]
[-NextHopType <String>]
[-NextHopIpAddress <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzRouteConfig cmdlet updates a route configuration for a route table.
Examples
Example 1: Modify a route
Get-AzRouteTable -ResourceGroupName "ResourceGroup11" -Name "RouteTable01" | Set-AzRouteConfig -Name "Route02" -AddressPrefix 10.4.0.0/16 -NextHopType VnetLocal | Set-AzRouteTable
Name : Routetable01
ResourceGroupName : ResourceGroup11
Location : eastus
Id : /subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/ResourceGroup11/providers/Microsoft.Networ
k/routeTables/RouteTable01
Etag : W/"58c2922e-9efe-4554-a457-956ef44bc718"
ProvisioningState : Succeeded
Tags :
Routes : [
{
"Name": "Route07",
"Etag": "W/\"58c2922e-9efe-4554-a457-956ef44bc718\"",
"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/\"58c2922e-9efe-4554-a457-956ef44bc718\"",
"Id": "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/ResourceGroup11/providers/Micro
soft.Network/routeTables/routetable01/routes/route02",
"AddressPrefix": "10.4.0.0/16",
"NextHopType": "VnetLocal",
"NextHopIpAddress": null,
"ProvisioningState": "Succeeded"
}
]
Subnets : []
This command gets the route table named RouteTable01 by using the Get-AzRouteTable cmdlet. The command passes that table to the current cmdlet by using the pipeline operator. The current cmdlet modifies the route named Route02, and then passes the result to the Set-AzRouteTable cmdlet, which updates the table to reflect your changes.
Example 2: Modify a route using a Service Tag (Public Preview)
Set-AzRouteConfig -Name "Route02" -AddressPrefix "AppService" -NextHopType "VirtualAppliance" -NextHopIpAddress "10.0.2.4"
This command modifies the route named Route02, supplying a Service Tag as the AddressPrefix parameter.
Parameters
-AddressPrefix
Specifies the destination, in Classless Interdomain Routing (CIDR) format, to which the route applies. You can also specify a Service Tag here (this feature is in Public Preview).
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: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
Specifies the name of the route that this cmdlet modifies.
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 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.
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 Azureserver-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 |
-RouteTable
Specifies the route table with which this route is associated.
Type: | PSRouteTable |
Position: | Named |
Default value: | None |
Required: | True |
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 |