Application Gateway update http-settings --connection-draining-timeout bug
Describe the bug There are a few issues. These are the ones I have discovered: Issue 1: (This is only an issue on an application gateway that never had connection draining enabled) When you create a new Application Gateway, you are not able to set --connection-draining-timeout through the CLI, since it is missing the parameter enabled. Once you have enabled Connection draining once through the Azure portal, then you are able to set --connection-draining-timeout
2: When you set --connection-draining-timeout to zero, it should be disabled. It returns 1 as the timeout and shows enabled: false, but when you check portal.azure.com, it is still enabled with a 1 sec timeout.
-- This means you can't disable connection draining through the CLI at the moment or enable it on a newly created APP Gateway.
To Reproduce Steps to reproduce the behavior.
Issue 1: On a newly created Application Gateway, use: az network application-gateway http-settings update --gateway-name appgwtest01 --name appGatewayBackendHttpSettings --resource-group AppGWTest --connection-draining-timeout 60
Returns: "Error, can't get field enabled"
Issue 2: az network application-gateway http-settings update --gateway-name appgwtest01 --name appGatewayBackendHttpSettings --resource-group AppGWTest --connection-draining-timeout 0
Returns: "connectionDraining": { "drainTimeoutInSec": 1, "enabled": false },
Expected behavior A clear and concise description of what you expected to happen.
Issue 1: This should enable the Connection draining, since the value is above 0 and not return an error with a field it's not able to find.
Issue 2: The expected result is drainTimeoutInSec should be 0 and also be disabled on portal.azure.com - It shows as enabled on the portal since the value is above 0.
Environment summary az--version: azure-cli (2.0.54) Windows 10 - Powershell
Additional context I have used the CLI help resource.
The following worked for me:
az network application-gateway create -g {rg} -n ag1 --connection-draining-timeout 60
This correctly enabled the connection draining timeout on the portal.
az network application-gateway http-settings update -g {rg} --gateway-name ag1 -n appGatewayBackendHttpSettings --connection-draining-timeout 0
This correctly showed as disabled on the portal when I refreshed the blade. The reason is puts a 1 for the value when you specify 0 is because there is a service side bug that will not accept a value of 0. However, internally, the CLI uses 0 as a sentinel to switch enabled to false.
I can reproduce issue 1 and will push a fix.
The following worked for me:
az network application-gateway create -g {rg} -n ag1 --connection-draining-timeout 60This correctly enabled the connection draining timeout on the portal.
az network application-gateway http-settings update -g {rg} --gateway-name ag1 -n appGatewayBackendHttpSettings --connection-draining-timeout 0This correctly showed as disabled on the portal when I refreshed the blade. The reason is puts a 1 for the value when you specify 0 is because there is a service side bug that will not accept a value of 0. However, internally, the CLI uses 0 as a sentinel to switch
enabledto false.
I can confirm this works as intended. I tried to switch it to 0 again and now the connection-drain seems to be disabled on the azure portal as well even though it shows 1 as the output.
@tobiasahlm thanks for the confirmation. Rather than expose two parameters, we decided to have the CLI interpret 0 as "disabled", but the service won't actually accept a value of 0. That's why you see a value of 1. The second issue will be fixed in a PR this sprint and should be in the next release.