You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/web-application-firewall/afds/waf-front-door-configure-custom-response-code.md
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,16 @@ By default, when Azure Web Application Firewall blocks a request because of a ma
33
33
34
34
You can also [install Azure PowerShell locally](/powershell/azure/install-azure-powershell) to run the cmdlets. This article requires the Azure PowerShell module. If you run PowerShell locally, sign in to Azure using the [Connect-AzAccount](/powershell/module/az.accounts/connect-azaccount) cmdlet.
35
35
36
+
# [**Azure CLI**](#tab/cli)
37
+
38
+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
39
+
40
+
- Azure Cloud Shell or Azure CLI.
41
+
42
+
The steps in this article run the Azure CLI commands interactively in [Azure Cloud Shell](/azure/cloud-shell/overview). To run the commands in the Cloud Shell, select **Open Cloud Shell** at the upper-right corner of a code block. Select **Copy** to copy the code, and paste it into Cloud Shell to run it. You can also run the Cloud Shell from within the Azure portal.
43
+
44
+
You can also [install Azure CLI locally](/cli/azure/install-azure-cli) to run the commands. This article requires the Azure CLI version 2.67.0 or higher and **front-door** extension. Run [az --version](/cli/azure/reference-index#az-version) command to find the installed version. If you run Azure CLI locally, sign in to Azure using the [az login](/cli/azure/reference-index#az-login) command.
45
+
36
46
---
37
47
38
48
## Configure a custom response status code and message
@@ -61,7 +71,7 @@ To customize the response status code and body, use [Update-AzFrontDoorWafPolicy
61
71
62
72
63
73
```azurepowershell-interactive
64
-
# modify WAF response body
74
+
# Update WAF policy settings to customize response body and status code
65
75
Update-AzFrontDoorWafPolicy `
66
76
-Name 'myWAFPolicy' `
67
77
-ResourceGroupName 'myResourceGroup' `
@@ -71,6 +81,25 @@ Update-AzFrontDoorWafPolicy `
71
81
-CustomBlockResponseBody '<html><head><title>WAF Demo</title></head><body><p><h1><strong>WAF Custom Response Page</strong></h1></p><p>Please contact us with this information:<br>{{azure-ref}}</p></body></html>'
72
82
```
73
83
84
+
# [**Azure CLI**](#tab/cli)
85
+
86
+
To customize the response status code and body, use [az network front-door waf-policy update](/cli/azure/network/front-door/waf-policy#az-network-front-door-waf-policy-update) command.
87
+
88
+
89
+
```azurecli-interactive
90
+
# Update WAF policy settings to customize response body and status code
0 commit comments