-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
I've been having issues with the deployment of a new gateway on an existing Vnet and subnet. After several iterations trying to see what I could have misconfigured, I realized there is an ARM deployment that gets generated with the command, in which it looks like VNET and SUBNET information are overwritten by new address-prefixes for both the vnet and subnet.
To validate issues I tried out the CLI quickstart on this document: https://learn.microsoft.com/en-us/azure/application-gateway/quick-create-cli
- This is how my subnets look like when going through Quickstart, before running the app gateway
createcommand.
- Then I execute the app gateway
createcommand, notice how my subnets have been reset: one is deleted and the address space for the vnet and subnet have been reset to something totally different.
Related command
az network application-gateway create \
--name myAppGateway \
--location eastus \
--resource-group $RESOURCE_GROUP \
--capacity 2 \
--sku Standard_v2 \
--public-ip-address myAGPublicIPAddress \
--vnet-name myVNet \
--subnet myAGSubnet \
--servers "www.uri2.com" "uri2" \
--priority 100
Errors
In this case there is no error generated but the command has deleted by subnet called myBackendSubnet which is a problem to deploy in any real environment.
Additionally the Public IP used had a DNS label set, and this has now been reset (removed the DNS label).
Issue script & Debug output
To repro the same behavior, follow the Quickstart and wonder if you can reproduce the vnet and subnets reset and deletion.
For repro of the Public IP DNS reset, change that command to something like (note the --dns-name):
az network public-ip create --resource-group $RESOURCE_GROUP --name myAGPublicIPAddress --allocation-method Static --sku Standard --dns-name MYCUSTOMLABEL
Expected behavior
When passing in a subnet Resource ID, or an existing vnet and subnet name, this command should deploy the app gateway in the chosen subnet but not delete any other subnets, or reset the address space for those.
Environment Summary
azure-cli 2.59.0
core 2.59.0
telemetry 1.1.0
Extensions:
azure-iot 0.23.1
azure-iot-ops 0.4.0b3
connectedk8s 1.6.7
k8s-extension 1.6.1
Dependencies:
msal 1.27.0
azure-mgmt-resource 23.1.0b2
Python location '/opt/az/bin/python3'
Extensions directory '/home/[...]/.azure/cliextensions'
Python (Linux) 3.11.8 (main, Mar 27 2024, 04:03:26) [GCC 9.4.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
I also did test with my own VNET and SUBNETs, including the NSG to allow GatewayManager on ports 65200-65535 set correctly upfront and it still deletes and recreates the address space and subnet.

