편집

다음을 통해 공유


New-AzFrontDoorRulesEngineRuleObject

Create a PSRulesEngineRule object for Rules Engine creation.

Syntax

New-AzFrontDoorRulesEngineRuleObject
   -Name <String>
   -Priority <Int32>
   -Action <PSRulesEngineAction>
   [-MatchProcessingBehavior <PSMatchProcessingBehavior>]
   [-MatchCondition <PSRulesEngineMatchCondition[]>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

Create a PSRulesEngineRule object for Rules Engine creation.

Use cmdlet "New-AzFrontDoorRulesEngineActionObject" to create PSRulesEngineAction object to pass into the "-Action" parameter. Use cmdlet "New-AzFrontDoorRulesEngineMatchConditionObject" to create PSRulesEngineMatchCondition object to pass into the "-MatchCondition" parameter.

Examples

Example 1

New-AzFrontDoorRulesEngineRuleObject -Name rules1 -Priority 0 -Action $rulesEngineAction -MatchProcessingBehavior Stop -MatchCondition $rulesEngineMatchCondition

Name                    : rules1
Priority                : 0
MatchProcessingBehavior : Stop
MatchCondition          : {Microsoft.Azure.Commands.FrontDoor.Models.PSRulesEngineMatchCondition}
Action                  : Microsoft.Azure.Commands.FrontDoor.Models.PSRulesEngineAction


$rulesEngineRule1.Action

RequestHeaderActions           ResponseHeaderActions RouteConfigurationOverride
--------------------           --------------------- --------------------------
{headeraction1, headeraction2} {}                    Microsoft.Azure.Commands.FrontDoor.Models.PSForwardingConfiguration

$rulesEngineRule1.MatchCondition[0]

RulesEngineMatchVariable : RequestHeader
RulesEngineMatchValue    : {allowoverride}
Selector                 : Rules-Engine-Route-Forward
RulesEngineOperator      : Equal
NegateCondition          : False
Transforms               : {Lowercase, Uppercase}

Create new PSRulesEngineRule object and demonstrate how to see the subfields.

Example 2

New-AzFrontDoorRulesEngineRuleObject -Name rules1 -Priority -1

New-AzFrontDoorRulesEngineRuleObject : Cannot validate argument on parameter 'Priority'. The -1 argument is less than the minimum allowed range of 0. Supply an argument that is greater than or equal to 0 and then try the command again.
At line:1 char:81
+ ... ule1 = New-AzFrontDoorRulesEngineRuleObject -Name rules1 -Priority -1
+                                                                        ~~
+ CategoryInfo          : InvalidData: (:) [New-AzFrontDoorRulesEngineRuleObject], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.FrontDoor.Cmdlets.NewFrontDoorRulesEngineRuleObject

Expect output when passing in invalid priority value.

Parameters

-Action

Actions to perform on the request and response if all of the match conditions are met.

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

-DefaultProfile

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

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

-MatchCondition

A list of match conditions that must meet in order for the actions of this rule to run. Having no match conditions means the actions will always run.

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

-MatchProcessingBehavior

If this rule is a match should the rules engine continue running the remaining rules or stop. Possible values are Continue and Stop. If not present, defaults to Continue.

Type:PSMatchProcessingBehavior
Accepted values:Continue, Stop
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

A name to refer to this specific rule.

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

-Priority

A priority assigned to this rule. Cannot be negative.

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

Inputs

None

Outputs

PSRulesEngineRule