Upravit

Sdílet prostřednictvím


Add-AzApplicationGatewayCustomError

Adds a custom error to an application gateway.

Syntax

Add-AzApplicationGatewayCustomError
   -ApplicationGateway <PSApplicationGateway>
   -StatusCode <String>
   -CustomErrorPageUrl <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Add-AzApplicationGatewayCustomError cmdlet adds a custom error to an application gateway.

Examples

Example 1: Adds custom error to application gateway level

$resourceGroupName = "resourceGroupName"
$AppGWName = "applicationGatewayName"
$AppGw = Get-AzApplicationGateway -Name $AppGWName -ResourceGroupName $resourceGroupName
$customError502Url = "https://mycustomerrorpages.blob.core.windows.net/errorpages/502.htm"
$updatedgateway = Add-AzApplicationGatewayCustomError -ApplicationGateway $AppGw -StatusCode HttpStatus502 -CustomErrorPageUrl $customError502Url
Set-AzApplicationGateway -ApplicationGateway $AppGw

This command adds a custom error of http status code 502 to the application gateway $appgw, and return the updated gateway.

Example 2: Adds custom error to application gateway listener level

$resourceGroupName = "resourceGroupName"
 $AppGWName = "applicationGatewayName"
 $customError502Url = "https://mycustomerrorpages.blob.core.windows.net/errorpages/502.htm"
 $listenerName = "listenerName"
 $AppGw = Get-AzApplicationGateway -Name $AppGWName -ResourceGroupName $resourceGroupName
 $listener = Get-AzApplicationGatewayHttpListener -ApplicationGateway $AppGW -Name $listenerName
 $updatedListener = Add-AzApplicationGatewayHttpListenerCustomError -HttpListener $listener -StatusCode HttpStatus502 -CustomErrorPageUrl $customError502Url 
 Set-AzApplicationGateway -ApplicationGateway $AppGw

This command adds a custom error of http status code 502 to the application gateway $appgw at the listener level, and return the updated gateway.

Parameters

-ApplicationGateway

The Application Gateway

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

-CustomErrorPageUrl

Error page URL of the application gateway customer error.

Type:String
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

-StatusCode

Status code of the application gateway customer error.

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

Inputs

PSApplicationGateway

Outputs

PSApplicationGatewayCustomError