Add-AzApplicationGatewayCustomError

Adds a custom error to an application gateway.

Note

This is the previous version of our documentation. Please consult the most recent version for up-to-date information.

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

PS C:\> $resourceGroupName = "resourceGroupName"
PS C:\> $AppGWName = "applicationGatewayName"
PS C:\> $AppGw = Get-AzApplicationGateway -Name $AppGWName -ResourceGroup $resourceGroupName
PS C:\> $customError502Url = "https://mycustomerrorpages.blob.core.windows.net/errorpages/502.htm"
PS C:\> $updatedgateway = Add-AzApplicationGatewayCustomError -ApplicationGateway $AppGw -StatusCode HttpStatus502 -CustomErrorPageUrl $customError502Url
PS C:\> 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
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
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
Accept pipeline input:False
Accept wildcard characters:False
-StatusCode

Status code of the application gateway customer error.

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

Inputs

PSApplicationGateway

Outputs

PSApplicationGatewayCustomError