你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
New-AzFrontDoorRulesEngineRuleObject
创建用于创建规则引擎的 PSRulesEngineRule 对象。
语法
New-AzFrontDoorRulesEngineRuleObject
-Name <String>
-Priority <Int32>
-Action <PSRulesEngineAction>
[-MatchProcessingBehavior <PSMatchProcessingBehavior>]
[-MatchCondition <PSRulesEngineMatchCondition[]>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
创建用于创建规则引擎的 PSRulesEngineRule 对象。
使用 cmdlet“New-AzFrontDoorRulesEngineActionObject”创建 PSRulesEngineAction 对象以传入“-Action”参数。 使用 cmdlet“New-AzFrontDoorRulesEngineMatchConditionObject”创建 PSRulesEngineMatchCondition 对象以传入“-MatchCondition”参数。
示例
示例 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}
创建新的 PSRulesEngineRule 对象并演示如何查看子字段。
示例 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
传入无效优先级值时预期输出。
参数
-Action
如果满足所有匹配条件,则对请求和响应执行的操作。
类型: | PSRulesEngineAction |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | IAzureContextContainer |
别名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-MatchCondition
必须满足的匹配条件列表,以便运行此规则的操作。 没有匹配条件意味着操作将始终运行。
类型: | PSRulesEngineMatchCondition[] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-MatchProcessingBehavior
如果此规则是匹配规则,则规则引擎应继续运行剩余规则或停止。 可能的值为 Continue 和 Stop。 如果不存在,则默认为“继续”。
类型: | PSMatchProcessingBehavior |
接受的值: | Continue, Stop |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Name
要引用此特定规则的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-Priority
分配给此规则的优先级。 不能为负数。
类型: | Int32 |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
输入
None