New-AzRouteMap
Erstellen Sie eine Routenzuordnung zu einem VirtualHub.
Syntax
New-AzRouteMap
[-ResourceGroupName <String>]
[-VirtualHubName <String>]
[-Name <String>]
[-RouteMapRule <PSRouteMapRule[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzRouteMap
[-VirtualHubObject <PSVirtualHub>]
[-Name <String>]
[-RouteMapRule <PSRouteMapRule[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzRouteMap
[-VirtualHubResourceId <String>]
[-Name <String>]
[-RouteMapRule <PSRouteMapRule[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Beschreibung
Erstellen Sie eine Routenzuordnung zu einem VirtualHub.
Beispiele
Beispiel 1: Erstellen einer Routenkarte
New-AzVirtualWan -ResourceGroupName "testRg" -Name "testWan" -Location "westcentralus" -VirtualWANType "Standard" -AllowVnetToVnetTraffic -AllowBranchToBranchTraffic
$virtualWan = Get-AzVirtualWan -ResourceGroupName "testRg" -Name "testWan"
New-AzVirtualHub -ResourceGroupName "testRg" -Name "testHub" -Location "westcentralus" -AddressPrefix "10.0.0.0/16" -VirtualWan $virtualWan
$virtualHub = Get-AzVirtualHub -ResourceGroupName "testRg" -Name "testHub"
# creating new route map rules and a new route map resource and new routing configuration
$routeMapMatchCriterion1 = New-AzRouteMapRuleCriterion -MatchCondition "Contains" -RoutePrefix @("10.0.0.0/16")
$routeMapActionParameter1 = New-AzRouteMapRuleActionParameter -AsPath @("12345")
$routeMapAction1 = New-AzRouteMapRuleAction -Type "Add" -Parameter @($routeMapActionParameter1)
$routeMapRule1 = New-AzRouteMapRule -Name "rule1" -MatchCriteria @($routeMapMatchCriterion1) -RouteMapRuleAction @($routeMapAction1) -NextStepIfMatched "Continue"
$routeMapMatchCriterion2 = New-AzRouteMapRuleCriterion -MatchCondition "Equals" -AsPath @("12345")
$routeMapAction2 = New-AzRouteMapRuleAction -Type "Drop"
$routeMapRule2 = New-AzRouteMapRule -Name "rule2" -MatchCriteria @($routeMapMatchCriterion2) -RouteMapRuleAction @($routeMapAction2) -NextStepIfMatched "Terminate"
New-AzRouteMap -ResourceGroupName "testRg" -VirtualHubName "testHub" -Name "testRouteMap" -RouteMapRule @($routeMapRule1, $routeMapRule2)
Name : testRouteMap
Id : /subscriptions/62364504-2406-418e-971c-05822ff72fad/resourceGroups/routemap0419/providers/Microsoft.Network/virtualHubs/westcentralus_hub1/routeMaps/testRouteMap
ProvisioningState : Succeeded
RouteMapRules : [
{
"Name": "rule1",
"MatchCriteria": [
{
"MatchCondition": "Contains",
"RoutePrefix": [
"10.0.0.0/16"
],
"Community": [],
"AsPath": []
}
],
"Actions": [
{
"Type": "Add",
"Parameters": [
{
"RoutePrefix": [],
"Community": [],
"AsPath": [
"12345"
]
}
]
}
],
"NextStepIfMatched": "Continue"
},
{
"Name": "rule2",
"MatchCriteria": [
{
"MatchCondition": "Equals",
"RoutePrefix": [],
"Community": [],
"AsPath": [
"12345"
]
}
],
"Actions": [
{
"Type": "Drop",
"Parameters": []
}
],
"NextStepIfMatched": "Terminate"
}
]
AssociatedInboundConnections : []
AssociatedOutboundConnections : []
Beispiel 2: Anwenden der Routenzuordnung auf Verbindungen
$testRouteMap = Get-AzRouteMap -ResourceGroupName "testRg" -VirtualHubName "testHub" -Name "testRouteMap"
$rt1 = Get-AzVHubRouteTable -ResourceGroupName "testRg" -VirtualHubName "testHub" -Name "defaultRouteTable"
$rt2 = Get-AzVHubRouteTable -ResourceGroupName "testRg" -VirtualHubName "testHub" -Name "noneRouteTable"
$testRoutingConfiguration =New-AzRoutingConfiguration -AssociatedRouteTable $rt1.Id -Label @("testLabel") -Id @($rt2.Id) -InboundRouteMap @($testRouteMap.Id)
# creating virtual network and a virtual hub vnet connection resource
$frontendSubnet = New-AzVirtualNetworkSubnetConfig -Name frontendSubnet -AddressPrefix "10.2.1.0/24"
$backendSubnet = New-AzVirtualNetworkSubnetConfig -Name backendSubnet -AddressPrefix "10.2.2.0/24"
$remoteVirtualNetwork = New-AzVirtualNetwork -Name "MyVirtualNetwork" -ResourceGroupName "testRG" -Location "westcentralus" -AddressPrefix "10.2.0.0/16" -Subnet $frontendSubnet,$backendSubnet
New-AzVirtualHubVnetConnection -ResourceGroupName "testRG" -VirtualHubName "testHub" -Name "testvnetconnection" -RemoteVirtualNetwork $remoteVirtualNetwork -RoutingConfiguration $testRoutingConfiguration
Name : testvnetconnection
Id : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualHubs/westushub/hubVirtualNetworkConnections/testvnetconnection
RemoteVirtualNetwork : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualNetworks/MyVirtualNetwork
EnableInternetSecurity : False
ProvisioningState : Succeeded
RoutingConfiguration : {
"AssociatedRouteTable": {
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
},
"PropagatedRouteTables": {
"Labels": [],
"Ids": [
{
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
}
]
},
"VnetRoutes": {
"StaticRoutes": []
},
"InboundRouteMap": {
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualHubs/westushub/routeMaps/testRouteMap"
}
}
Parameter
-AsJob
Cmdlet im Hintergrund ausführen
Typ: | SwitchParameter |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | False |
Platzhalterzeichen akzeptieren: | False |
-Confirm
Hiermit werden Sie vor der Ausführung des Cmdlets zur Bestätigung aufgefordert.
Typ: | SwitchParameter |
Aliase: | cf |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | False |
Platzhalterzeichen akzeptieren: | False |
-DefaultProfile
Anmeldeinformationen, Konto, Mandant und Abonnement für die Kommunikation mit Azure
Typ: | IAzureContextContainer |
Aliase: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | False |
Platzhalterzeichen akzeptieren: | False |
-Name
Der Name der Routenkarte.
Typ: | String |
Aliase: | ResourceName, RouteMapName |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | False |
Platzhalterzeichen akzeptieren: | False |
-ResourceGroupName
Der Name der Ressourcengruppe.
Typ: | String |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | False |
Platzhalterzeichen akzeptieren: | False |
-RouteMapRule
Liste der Routenkartenregeln in der Routenkarte.
Typ: | PSRouteMapRule[] |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | False |
Platzhalterzeichen akzeptieren: | False |
-VirtualHubName
Der Name des virtuellen Hubs.
Typ: | String |
Aliase: | ParentVirtualHubName, ParentResourceName |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | False |
Platzhalterzeichen akzeptieren: | False |
-VirtualHubObject
Das Virtual Hub-Objekt.
Typ: | PSVirtualHub |
Aliase: | VirtualHub, ParentVirtualHub |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | True |
Platzhalterzeichen akzeptieren: | False |
-VirtualHubResourceId
Die Virtual Hub-Ressourcen-ID.
Typ: | String |
Aliase: | VirtualHubId, ParentVirtualHubId |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | True |
Platzhalterzeichen akzeptieren: | False |
-WhatIf
Zeigt, was geschieht, wenn das Cmdlet ausgeführt wird. Das Cmdlet wird nicht ausgeführt.
Typ: | SwitchParameter |
Aliase: | wi |
Position: | Named |
Standardwert: | None |
Erforderlich: | False |
Pipelineeingabe akzeptieren: | False |
Platzhalterzeichen akzeptieren: | False |
Eingaben
Ausgaben
Ähnliche Themen
Azure PowerShell