你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Add-AzApplicationGatewayRoutingRule

将路由规则添加到应用程序网关。

语法

Add-AzApplicationGatewayRoutingRule
   -ApplicationGateway <PSApplicationGateway>
   -Name <String>
   -RuleType <String>
   -Priority <Int32>
   [-BackendSettings <PSApplicationGatewayBackendSettings>]
   [-Listener <PSApplicationGatewayListener>]
   [-BackendAddressPool <PSApplicationGatewayBackendAddressPool>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Add-AzApplicationGatewayRoutingRule
   -ApplicationGateway <PSApplicationGateway>
   -Name <String>
   -RuleType <String>
   -Priority <Int32>
   [-BackendSettingsId <String>]
   [-ListenerId <String>]
   [-BackendAddressPoolId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

说明

Add-AzApplicationGatewayRoutingRule cmdlet 向应用程序网关添加路由规则。

示例

示例 1:将路由规则添加到应用程序网关

$AppGw = Get-AzApplicationGateway -Name "ApplicationGateway01" -ResourceGroupName "ResourceGroup01"
$Appgw = Add-AzApplicationGatewayRoutingRule -ApplicationGateway $AppGw -Name "Rule01" -RuleType Basic -Priority 100 -BackendSettings $Setting -Listener $Listener -BackendAddressPool $Pool

第一个命令获取应用程序网关并将其存储在$AppGw变量中。 第二个命令将路由规则添加到应用程序网关。

参数

-ApplicationGateway

applicationGateway

Type:PSApplicationGateway
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-BackendAddressPool

应用程序网关 BackendAddressPool

Type:PSApplicationGatewayBackendAddressPool
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-BackendAddressPoolId

应用程序网关 BackendAddressPool 的 ID

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-BackendSettings

应用程序网关后端设置

Type:PSApplicationGatewayBackendSettings
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-BackendSettingsId

应用程序网关后端的 ID设置

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

用于与 Azure 通信的凭据、帐户、租户和订阅。

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Listener

应用程序网关侦听器

Type:PSApplicationGatewayListener
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ListenerId

应用程序网关侦听器的 ID

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

路由规则的名称

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Priority

规则的优先级

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RuleType

规则的类型

Type:String
Accepted values:Basic, PathBasedRouting
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

输入

PSApplicationGateway

输出

PSApplicationGateway