Azure: WEB Listener cannot be deleted on Azure Application Gateway
August 23, 2018
Posted by on
Recently I had a project where I needed to put an Azure App Service behind App Gateway.
The Customer also asked to create HTTP-HTTPS redirection for better and-user experience.
I created two listeners (for port 80 and 443) and two rules: one for traffic on port 443 to redirect to my backend pool and the second one for traffic on port 80 – to redirect to my 443 listener. Everything worked fine. We progressed with the project and at a certain time needed to remove the listeners.
From my previous experience I knew – you never delete rules first – delete the listener first. Since we did have a redirection I deleted port 80 listener first. Azure kindly deleted associated rule. At least it is disappeared
Next I tried to delete 443 Listener and at that point got an error saying:
“Failed to save configuration changes to application gateway…. Error: Resource <Path to my 443 Listener> referenced by resource <Path to my HTTP-HTTPS redirection rule> was not found. Please make sure that the referenced resource exists and both resources are in the same region.”
Sounds weird taking in consideration I did not see the redirection rule in GUI.
So I brought Azure CLI (for some reasons MS provided commands for CLI, or maybe I just did not find those for PowerShell) and run
az network application-gateway redirect-config show -g <resource group name> –gateway-name <gateway name>
sure enough the rule was still there.
after that I run
az network application-gateway redirect-config delete –g <resource group name> –gateway-name <gateway name> –n <rule name>
and this time the rule was deleted completely.
After that the remaining listener was deleted without problems.