@@ -109,25 +109,27 @@ Set-AzApplicationGatewayRequestRoutingRule -ApplicationGateway $appgw -Name $req
109
109
Set-AzApplicationGateway -ApplicationGateway $appgw
110
110
```
111
111
112
- ## Delete a rewrite rule
112
+ ## Remove a rewrite rule (Optional)
113
113
114
- To remove a rewrite rule set from your Application Gateway configuration :
114
+ If you need to remove a rewrite rule set from your Application Gateway, use the following steps :
115
115
116
116
``` azurepowershell-interactive
117
117
# Retrieve the current Application Gateway configuration
118
118
$appgw = Get-AzApplicationGateway -Name "AutoscalingAppGw" -ResourceGroupName "<rg name>"
119
119
120
+ # Remove the rewrite rule set association from the routing rule first
121
+ $requestRoutingRule = Get-AzApplicationGatewayRequestRoutingRule -Name "rule1" -ApplicationGateway $appgw
122
+
123
+ # Clear the rewrite rule set reference
124
+ $requestRoutingRule.RewriteRuleSet = $null
125
+
120
126
# Remove the rewrite rule set from the Application Gateway
121
127
Remove-AzApplicationGatewayRewriteRuleSet -Name "LocationHeaderRewrite" -ApplicationGateway $appgw
122
128
123
- # Get the request routing rule and clear the rewrite rule set reference
124
- $requestroutingrule = Get-AzApplicationGatewayRequestRoutingRule -Name "rule1" -ApplicationGateway $appgw
125
- $requestroutingrule.RewriteRuleSet = $null
126
-
127
- # Apply the configuration changes
129
+ # Apply the changes
128
130
Set-AzApplicationGateway -ApplicationGateway $appgw
129
131
130
- Write-Output "Rewrite rule set 'LocationHeaderRewrite' has been removed successfully"
132
+ Write-Output "Rewrite rule set removed successfully"
131
133
```
132
134
133
135
## Next steps
0 commit comments