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

Add-AzApplicationGatewayUrlPathMapConfig

将 URL 路径映射数组添加到后端服务器池。

语法

Add-AzApplicationGatewayUrlPathMapConfig
   -ApplicationGateway <PSApplicationGateway>
   -Name <String>
   -PathRules <PSApplicationGatewayPathRule[]>
   -DefaultBackendAddressPool <PSApplicationGatewayBackendAddressPool>
   -DefaultBackendHttpSettings <PSApplicationGatewayBackendHttpSettings>
   [-DefaultRewriteRuleSet <PSApplicationGatewayRewriteRuleSet>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Add-AzApplicationGatewayUrlPathMapConfig
   -ApplicationGateway <PSApplicationGateway>
   -Name <String>
   -PathRules <PSApplicationGatewayPathRule[]>
   -DefaultBackendAddressPoolId <String>
   -DefaultBackendHttpSettingsId <String>
   [-DefaultRewriteRuleSetId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Add-AzApplicationGatewayUrlPathMapConfig
   -ApplicationGateway <PSApplicationGateway>
   -Name <String>
   -PathRules <PSApplicationGatewayPathRule[]>
   [-DefaultRewriteRuleSet <PSApplicationGatewayRewriteRuleSet>]
   -DefaultRedirectConfiguration <PSApplicationGatewayRedirectConfiguration>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Add-AzApplicationGatewayUrlPathMapConfig
   -ApplicationGateway <PSApplicationGateway>
   -Name <String>
   -PathRules <PSApplicationGatewayPathRule[]>
   [-DefaultRewriteRuleSetId <String>]
   -DefaultRedirectConfigurationId <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

说明

Add-AzApplicationGatewayUrlPathMapConfig cmdlet 将 URL 路径映射数组添加到后端服务器池。

示例

示例 1:向应用程序网关添加 URL 路径映射。

$appgw = Get-AzApplicationGateway -ResourceGroupName "rg" -Name "appGwName"
$pool = Get-AzApplicationGatewayBackendAddressPool -ApplicationGateway $appgw -Name "pool01"
$poolSettings = Get-AzApplicationGatewayBackendHttpSetting -ApplicationGateway $appgw -Name "poolSettings01"
$pathRule = New-AzApplicationGatewayPathRuleConfig -Name "rule01" -Paths "/path" -BackendAddressPool $pool -BackendHttpSettings $poolSettings
$appgw = Add-AzApplicationGatewayUrlPathMapConfig -ApplicationGateway $appgw -Name "url01" -PathRules $pathRule -DefaultBackendAddressPool $pool -DefaultBackendHttpSettings $poolSettings
$appgw = Set-AzApplicationGateway -ApplicationGateway $appgw

第一个命令获取名为 appGwName 的应用程序网关,并将其存储在$appgw变量中。 第二个命令获取后端地址池并将其存储在$pool变量中。 第三个命令获取后端 http 设置并将其存储在$pool设置变量中。 第四个命令创建名为 rule01 的新路径规则配置,并将其存储在$pathRule变量中。 第五个命令将名为 url01 的 URL 路径映射配置添加到应用程序网关。 第六个命令更新应用程序网关。

参数

-ApplicationGateway

指定此 cmdlet 向其添加 URL 路径映射配置的应用程序网关。

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

-DefaultBackendAddressPool

指定要路由的默认后端地址池,以防 pathRules 参数匹配中指定的任何规则。

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

-DefaultBackendAddressPoolId

指定默认后端地址池 ID。

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

-DefaultBackendHttpSettings

指定要使用的默认后端 HTTP 设置,以防 pathRules 参数匹配中指定的任何规则。

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

-DefaultBackendHttpSettingsId

指定默认后端 HTTP 设置 ID。

Type:String
Position:Named
Default value:None
Required:True
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

-DefaultRedirectConfiguration

应用程序网关默认 RedirectConfiguration

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

-DefaultRedirectConfigurationId

应用程序网关默认 RedirectConfiguration 的 ID

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

-DefaultRewriteRuleSet

应用程序网关默认重写规则集

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

-DefaultRewriteRuleSetId

应用程序网关默认重写规则集的 ID

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

-Name

指定此 cmdlet 添加到后端服务器池的 URL 路径映射名称。

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

-PathRules

指定路径规则的列表。 路径规则区分顺序,按指定顺序应用这些规则。

Type:PSApplicationGatewayPathRule[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

输入

PSApplicationGateway

输出

PSApplicationGateway