Modifier

Partager via


New-AzFrontDoorRulesEngineActionObject

Create a PSRulesEngineAction object for creating a rules engine rule.

Syntax

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>]

Description

Create a PSRulesEngineAction object for creating a rules engine rule.

Use cmdlet "New-AzFrontDoorHeaderActionObject" to create PSHeaderObjects to pass into the parameters "-RequestHeaderActions" and "-ResponseHeaderActions".

Examples

Example 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}

Create a rules engine action that append response header value and show how to view the properties of the rules engine action created.

Example 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

Create a rules engine action that forwards the requests to a speicific backend pool and show how to view the properties of the rules engine action created.

Example 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 :

Create a rules engine action that redirects the requests to another host and show how to view the properties of the rules engine action created.

Parameters

-BackendPoolName

The name of the BackendPool which this rule routes to

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

-CustomForwardingPath

The custom path used to rewrite resource paths matched by this rule. Leave empty to use incoming path.

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

-CustomFragment

Fragment to add to the redirect URL. Fragment is the part of the URL that comes after #. Do not include the #.

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

-CustomHost

Host to redirect. Leave empty to use the incoming host as the destination host.

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

-CustomPath

The full path to redirect. Path cannot be empty and must start with /. Leave empty to use the incoming path as destination path.

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

-CustomQueryString

The set of query strings to be placed in the redirect URL. Setting this value would replace any existing query string; leave empty to preserve the incoming query string. Query string must be in <key>=<value> format. The first ? and & will be added automatically so do not include them in the front, but do separate multiple query strings with &.

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

-DynamicCompression

Whether to enable dynamic compression for cached content. Default value is Enabled

Type:PSEnabledState
Accepted values:Enabled, Disabled
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnableCaching

Whether to enable caching for this route. Default value is false

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

-ForwardingProtocol

The protocol this rule will use when forwarding traffic to backends. Default value is MatchRequest

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

-FrontDoorName

The name of the Front Door to which this routing rule belongs.

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

-QueryParameterStripDirective

The treatment of URL query terms when forming the cache key. Default value is StripAll

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

-RedirectProtocol

The protocol of the destination to where the traffic is redirected. Default value is MatchRequest

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

-RedirectType

The redirect type the rule will use when redirecting traffic. Default Value is Moved

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

-RequestHeaderAction

A list of header actions to apply from the request from AFD to the origin.

Type:List<T>[PSHeaderAction]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The resource group name that the RoutingRule will be created in.

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

-ResponseHeaderAction

A list of header actions to apply from the response from AFD to the client.

Type:List<T>[PSHeaderAction]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

PSRulesEngineAction