Edit

Share via


New-AzApplicationGatewayPathRuleConfig

Creates an application gateway path rule.

Syntax

SetByResourceId

New-AzApplicationGatewayPathRuleConfig
    -Name <String>
    -Paths <String[]>
    [-BackendAddressPoolId <String>]
    [-BackendHttpSettingsId <String>]
    [-RewriteRuleSetId <String>]
    [-RedirectConfigurationId <String>]
    [-FirewallPolicyId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

SetByResource

New-AzApplicationGatewayPathRuleConfig
    -Name <String>
    -Paths <String[]>
    [-BackendAddressPool <PSApplicationGatewayBackendAddressPool>]
    [-BackendHttpSettings <PSApplicationGatewayBackendHttpSettings>]
    [-RewriteRuleSet <PSApplicationGatewayRewriteRuleSet>]
    [-RedirectConfiguration <PSApplicationGatewayRedirectConfiguration>]
    [-FirewallPolicy <PSApplicationGatewayWebApplicationFirewallPolicy>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The New-AzApplicationGatewayPathRuleConfig cmdlet creates an application gateway path rule. Rules created by this cmdlet can be added to a collection of URL path map configuration settings and then assigned to a gateway. Path map configuration settings are used in application gateway load balancing.

Examples

Example 1

$Gateway = Get-AzApplicationGateway -Name "ContosoApplicationGateway"
$AddressPool = New-AzApplicationGatewayBackendAddressPool -Name "ContosoAddressPool" -BackendIPAddresses "192.168.1.1", "192.168.1.2"
$HttpSettings = New-AzApplicationGatewayBackendHttpSetting -Name "ContosoHttpSettings" -Port 80 -Protocol "Http" -CookieBasedAffinity "Disabled"
$PathRuleConfig = New-AzApplicationGatewayPathRuleConfig -Name "base" -Paths "/base" -BackendAddressPool $AddressPool -BackendHttpSettings $HttpSettings
Add-AzApplicationGatewayUrlPathMapConfig -ApplicationGateway $Gateway -Name "ContosoUrlPathMap" -PathRules $PathRuleConfig -DefaultBackendAddressPool $AddressPool -DefaultBackendHttpSettings $HttpSettings

These commands create a new application gateway path rule and then use the Add-AzApplicationGatewayUrlPathMapConfig cmdlet to assign that rule to an application gateway. To do this, the first command creates an object reference to the gateway ContosoApplicationGateway. This object reference is stored in a variable named $Gateway. The next two commands create a backend address pool and a backend HTTP settings object; these objects (stored in the variables $AddressPool and $HttpSettings) are needed in order to create a path rule object. The fourth command creates the path rule object and is stored in a variable named $PathRuleConfig. The fifth command uses Add-AzApplicationGatewayUrlPathMapConfig to add the configuration settings and the new path rule contained within those settings to ContosoApplicationGateway.

Example 2

$PathRuleConfig = New-AzApplicationGatewayPathRuleConfig -Name "base" -Paths "/base" -BackendAddressPool $AddressPool -BackendHttpSettings $HttpSettings -FirewallPolicy $firewallPolicy

These command creates a path-rule with the Name as "base", Paths as "/base", BackendAddressPool as $AddressPool, BackendHttpSettings as $HttpSettings and FirewallPolicy as $firewallPolicy.ngs and the new path rule contained within those settings to ContosoApplicationGateway.

Parameters

-BackendAddressPool

Specifies an object reference to a collection of backend address pool settings to be added to the gateway path rules configuration settings. You can create this object reference by using the New-AzApplicationGatewayBackendAddressPool cmdlet and syntax similar to this: $AddressPool = New-AzApplicationGatewayBackendAddressPool -Name "ContosoAddressPool" -BackendIPAddresses "192.168.1.1", "192.168.1.2" The preceding command adds two IP addresses (192.16.1.1 and 192.168.1.2) to the address pool. Note that the IP address are enclosed in quote marks and separated by using commas. The resulting variable, $AddressPool, can then be used as the parameter value for the DefaultBackendAddressPool parameter. The backend address pool represents the IP addresses on the backend servers. These IP addresses should either belong to the virtual network subnet or should be public IP addresses. If you use this parameter you cannot use the DefaultBackendAddressPoolId parameter in the same command.

Parameter properties

Type:PSApplicationGatewayBackendAddressPool
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BackendAddressPoolId

Specifies the ID of an existing backend address pool that can be added to the gateway path rule configuration settings. Address pool IDs can be returned by using the Get-AzApplicationGatewayBackendAddressPool cmdlet. After you have the ID you can then use the DefaultBackendAddressPoolId parameter instead of the DefaultBackendAddressPool parameter. For instance: -DefaultBackendAddressPoolId "/subscriptions/39c54063-01d3-4abf-8f4c-234777bc1f10/resourceGroups/appgw-rg/providers/Microsoft.Network/applicationGateways/appgwtest/backendAddressPools/ContosoAddressPool" The backend address pool represents the IP addresses on the backend servers. These IP addresses should either belong to the virtual network subnet or should be public IP addresses.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BackendHttpSettings

Specifies an object reference to a collection of backend HTTP settings to be added to the gateway path rule configuration settings. You can create this object reference by using the New-AzApplicationGatewayBackendHttpSettings cmdlet and syntax similar to this: $HttpSettings = New-AzApplicationGatewayBackendHttpSettings -Name "ContosoHttpSettings" -Port 80 -Protocol "Http" -CookieBasedAffinity "Disabled" The resulting variable, $HttpSettings, can then be used as the parameter value for the DefaultBackendAddressPool parameter: -DefaultBackendHttpSettings $HttpSettings The backend HTTP settings configure properties such as port, protocol, and cookie-based affinity for a backend pool. If you use this parameter you cannot use the DefaultBackendHttpSettingsId parameter in the same command.

Parameter properties

Type:PSApplicationGatewayBackendHttpSettings
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BackendHttpSettingsId

Specifies the ID of an existing backend HTTP settings collection that can be added to the gateway path rule configuration settings. HTTP setting IDs can be returned by using the Get-AzApplicationGatewayBackendHttpSettings cmdlet. After you have the ID you can then use the DefaultBackendHttpSettingsId parameter instead of the DefaultBackendHttpSettings parameter. For instance: -DefaultBackendSettings Id "/subscriptions/39c54063-01d3-4abf-8f4c-234777bc1f10/resourceGroups/appgw-rg/providers/Microsoft.Network/applicationGateways/appgwtest/backendHttpSettingsCollection/ContosoHttpSettings" The backend HTTP settings configure properties such as port, protocol, and cookie-based affinity for a backend pool. If you use this parameter you cannot use the DefaultBackendHttpSettings parameter in the same command.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-FirewallPolicy

Specifies the object reference to a top-level firewall policy. The object reference can be created by using New-AzApplicationGatewayWebApplicationFirewallPolicy cmdlet. $firewallPolicy = New-AzApplicationGatewayFirewallPolicy -Name "wafPolicy1" -ResourceGroup "rgName" A firewall policy created using the above cmdlet can be referred at a path-rule level. he above command would create a default policy settings and managed rules. Instead of the default values, users can specify PolicySettings, ManagedRules by using New-AzApplicationGatewayFirewallPolicySettings and New-AzApplicationGatewayFirewallPolicyManagedRules respectively.

Parameter properties

Type:PSApplicationGatewayWebApplicationFirewallPolicy
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-FirewallPolicyId

Specifies the ID of an existing top-level web application firewall resource. Firewall policy IDs can be returned by using the Get-AzApplicationGatewayWebApplicationFirewallPolicy cmdlet. After we have the ID you can use FirewallPolicyId parameter instead of FirewallPolicy parameter. For instance: -FirewallPolicyId /subscriptions/<subscription-id>/resourceGroups/<resource-group-id>/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/<firewallPolicyName>

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the path rule configuration that this cmdlet creates.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Paths

Specifies one or more application gateway path rules.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RedirectConfiguration

Application gateway RedirectConfiguration

Parameter properties

Type:PSApplicationGatewayRedirectConfiguration
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RedirectConfigurationId

ID of the application gateway RedirectConfiguration

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RewriteRuleSet

Application gateway RewriteRuleSet

Parameter properties

Type:PSApplicationGatewayRewriteRuleSet
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RewriteRuleSetId

ID of the application gateway RewriteRuleSet

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

PSApplicationGatewayPathRule