你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
New-AzFrontDoorRulesEngineActionObject
创建用于创建规则引擎规则的 PSRulesEngineAction 对象。
语法
New-AzFrontDoorRulesEngineActionObject
[-RequestHeaderAction <System.Collections.Generic.List`1[Microsoft.Azure.Commands.FrontDoor.Models.PSHeaderAction]>]
[-ResponseHeaderAction <System.Collections.Generic.List`1[Microsoft.Azure.Commands.FrontDoor.Models.PSHeaderAction]>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzFrontDoorRulesEngineActionObject
[-RequestHeaderAction <System.Collections.Generic.List`1[Microsoft.Azure.Commands.FrontDoor.Models.PSHeaderAction]>]
[-ResponseHeaderAction <System.Collections.Generic.List`1[Microsoft.Azure.Commands.FrontDoor.Models.PSHeaderAction]>]
[-CustomForwardingPath <String>]
[-ForwardingProtocol <String>]
-ResourceGroupName <String>
-FrontDoorName <String>
-BackendPoolName <String>
[-EnableCaching <Boolean>]
[-QueryParameterStripDirective <String>]
[-DynamicCompression <PSEnabledState>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzFrontDoorRulesEngineActionObject
[-RequestHeaderAction <System.Collections.Generic.List`1[Microsoft.Azure.Commands.FrontDoor.Models.PSHeaderAction]>]
[-ResponseHeaderAction <System.Collections.Generic.List`1[Microsoft.Azure.Commands.FrontDoor.Models.PSHeaderAction]>]
[-RedirectType <String>]
[-RedirectProtocol <String>]
[-CustomHost <String>]
[-CustomPath <String>]
[-CustomFragment <String>]
[-CustomQueryString <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
创建用于创建规则引擎规则的 PSRulesEngineAction 对象。
使用 cmdlet“New-AzFrontDoorHeaderActionObject”创建 PSHeaderObjects 以传入参数“-RequestHeaderActions”和“-ResponseHeaderActions”。
示例
示例 1
$headerActions = New-AzFrontDoorHeaderActionObject -HeaderActionType "Append" -HeaderName "X-Content-Type-Options" -Value "nosniff"
$headerActions
HeaderName HeaderActionType Value
---------- ---------------- -----
X-Content-Type-Options Append nosniff
$rulesEngineAction = New-AzFrontDoorRulesEngineActionObject -ResponseHeaderAction $headerActions
$rulesEngineAction
RequestHeaderActions ResponseHeaderActions RouteConfigurationOverride
-------------------- --------------------- --------------------------
{} {X-Content-Type-Options}
创建一个规则引擎作,该作追加响应标头值并演示如何查看创建的规则引擎作的属性。
示例 2
$rulesEngineAction = New-AzFrontDoorRulesEngineActionObject -RequestHeaderAction $headerActions -ForwardingProtocol HttpsOnly -BackendPoolName mybackendpool -ResourceGroupName Jessicl-Test-RG -FrontDoorName jessicl-test-myappfrontend -QueryParameterStripDirective StripNone -DynamicCompression Disabled -EnableCaching $true
$rulesEngineAction
RequestHeaderAction ResponseHeaderAction RouteConfigurationOverride
------------------- -------------------- --------------------------
{headeraction1, headeraction2} {} Microsoft.Azure.Commands.FrontDoor.Models.PSForwardingConfiguration
$rulesEngineAction.RequestHeaderAction
HeaderName HeaderActionType Value
---------- ---------------- -----
headeraction1 Overwrite
headeraction2 Append
$rulesEngineAction.ResponseHeaderAction
$rulesEngineAction.RouteConfigurationOverride
CustomForwardingPath :
ForwardingProtocol : HttpsOnly
BackendPoolId : /subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/myresourcegroup/provi
ders/Microsoft.Network/frontDoors/myfrontdoor/BackendPools/mybackendpool
QueryParameterStripDirective : StripNone
DynamicCompression : Disabled
EnableCaching : True
创建一个规则引擎作,用于将请求转发到后台池,并演示如何查看创建的规则引擎作的属性。
示例 3
$rulesEngineAction = New-AzFrontDoorRulesEngineActionObject -RedirectType Moved -RedirectProtocol MatchRequest -CustomHost www.contoso.com
$rulesEngineAction
RequestHeaderActions ResponseHeaderActions RouteConfigurationOverride
-------------------- --------------------- --------------------------
{} {} Microsoft.Azure.Commands.FrontDoor.Models.PSRedirectConfiguration
$rulesEngineAction.RouteConfigurationOverride
RedirectType : Moved
RedirectProtocol : MatchRequest
CustomHost : www.contoso.com
CustomPath :
CustomFragment :
CustomQueryString :
创建将请求重定向到另一个主机的规则引擎作,并演示如何查看创建的规则引擎作的属性。
参数
-BackendPoolName
此规则路由到的 BackendPool 的名称
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-CustomForwardingPath
用于重写此规则匹配的资源路径的自定义路径。 留空以使用传入路径。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-CustomFragment
要添加到重定向 URL 的片段。 片段是 #之后 URL 的一部分。 请勿包含 #。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-CustomHost
要重定向的主机。 将传入主机保留为空,以将传入主机用作目标主机。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-CustomPath
要重定向的完整路径。 路径不能为空,必须以 /开头。 将传入路径保留为空,以用作目标路径。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-CustomQueryString
要放置在重定向 URL 中的查询字符串集。 设置此值将替换任何现有查询字符串;保留空以保留传入的查询字符串。 查询字符串必须采用 <键>=<值> 格式。 第一个? 并且会自动添加 &,因此不要在前面包含它们,但使用 &分隔多个查询字符串。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | IAzureContextContainer |
别名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DynamicCompression
是否为缓存内容启用动态压缩。 默认值为“已启用”
类型: | PSEnabledState |
接受的值: | Enabled, Disabled |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-EnableCaching
是否为此路由启用缓存。 默认值为 false
类型: | Boolean |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-ForwardingProtocol
将流量转发到后端时,此规则将使用的协议。 默认值为 MatchRequest
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-FrontDoorName
此路由规则所属的 Front Door 的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-QueryParameterStripDirective
形成缓存密钥时 URL 查询词的处理方式。 默认值为 StripAll
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-RedirectProtocol
将流量重定向到的目标的协议。 默认值为 MatchRequest
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-RedirectType
重定向流量时规则将使用的重定向类型。 默认值已移动
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-RequestHeaderAction
要从 AFD 到源的请求中应用的标头作列表。
类型: | List<T>[PSHeaderAction] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-ResourceGroupName
将在中创建 RoutingRule 的资源组名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-ResponseHeaderAction
要从 AFD 响应应用到客户端的标头作的列表。
类型: | List<T>[PSHeaderAction] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
输入
None