共用方式為


New-AzNetworkManagerRoutingRule

建立路由規則。

語法

New-AzNetworkManagerRoutingRule
   -Name <String>
   -RuleCollectionName <String>
   -RoutingConfigurationName <String>
   -NetworkManagerName <String>
   -ResourceGroupName <String>
   -Destination <PSNetworkManagerRoutingRuleDestination>
   -NextHop <PSNetworkManagerRoutingRuleNextHop>
   [-Description <String>]
   [-Force]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

New-AzNetworkManagerRoutingRule Cmdlet 會建立路由規則。

範例

範例 1:建立自定義路由規則

$destination = New-AzNetworkManagerRoutingRuleDestination -DestinationAddress "10.1.1.1/32" -Type "AddressPrefix" 
$nextHop = New-AzNetworkManagerRoutingRuleNextHop -NextHopType "VirtualAppliance" -NextHopAddress "2.2.2.2"
New-AzNetworkManagerRoutingRule -ResourceGroupName "psResourceGroup" -NetworkManagerName "psNetworkManager" -ConfigName "psRoutingConfig" -RuleCollectionName "psRuleCollection" -Name "psRule" -Description "TestDescription" -Destination $destination -NextHop $nextHop

Destination               : {Microsoft.Azure.Commands.Network.Models.NetworkManager.PSNetworkManagerRoutingRuleDestination}
NextHop                   : {Microsoft.Azure.Commands.Network.Models.NetworkManager.PSNetworkManagerRoutingRuleNextHop}
DisplayName               :
Description               : TestDescription
Type                      : Microsoft.Network/networkManagers/routingConfigurations/ruleCollections/rules
ProvisioningState         : Succeeded
SystemData                : Microsoft.Azure.Commands.Network.Models.NetworkManager.PSSystemData
SystemDataText            : {
                               "CreatedBy": "00000000-0000-0000-0000-000000000000",
                               "CreatedByType": "Application",
                               "CreatedAt": "2021-10-18T04:05:57",
                               "LastModifiedBy": "00000000-0000-0000-0000-000000000000",
                               "LastModifiedByType": "Application",
                               "LastModifiedAt": "2021-10-18T04:05:59"
                            }
Name                      : psRule
Etag                      :
Id                        : /subscriptions/f0dc2b34-dfad-40e4-83e0-2309fed8d00b/resourceGroups/psResourceGroup/providers/Microsoft.Network/networkManagers/psNetworkManager/routingConfigurations/psRoutingConfig/ruleCollections/psRuleCollection/rules/psRule

建立路由規則。

參數

-AsJob

在背景執行 Cmdlet

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Confirm

在執行 Cmdlet 之前,提示您進行確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-DefaultProfile

用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。

類型:IAzureContextContainer
別名:AzContext, AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Description

描述。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-Destination

目的地地址和類型。

類型:PSNetworkManagerRoutingRuleDestination
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Force

如果您想要覆寫資源,請勿要求確認

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Name

資源名稱。

類型:String
別名:ResourceName
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:True

-NetworkManagerName

網路管理員名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:True

-NextHop

下一個躍點位址和類型。

類型:PSNetworkManagerRoutingRuleNextHop
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-ResourceGroupName

資源組名。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-RoutingConfigurationName

網路管理員路由組態名稱。

類型:String
別名:ConfigName
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:True

-RuleCollectionName

網路管理員路由規則集合名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:True

-WhatIf

顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。

類型:SwitchParameter
別名:wi
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

String

PSNetworkManagerAddressPrefixItem[]

System.String[]

Int32

輸出

PSNetworkManagerRoutingRule