Azure / Azure/azure-cli

Incorrect output of the `az network vnet subnet list-available-ips` command

Open
#23,997 21 comments 2 reactions 0 assignees View on GitHub
act-quality-productivity-squad Auto-Assign customer-reported Mgmt needs-team-attention Network question Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

I was checking the number of available ip addresses in the subnet where an application gateway is deployed using this:

`schowdhu@schowdhu-mn1 ~ % az network vnet subnet list-available-ips --resource-group aag-rg --vnet-name aagVnet -n AAG1Subnet
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
[
"10.0.36.244",
"10.0.36.245",
"10.0.36.246",
"10.0.36.247",
"10.0.36.248"
]`

Following shows my subnet size and the app gw instances deployed.

`[schowdhu@schowdhu-ld3 ~]$ az network vnet subnet show -g aag-rg -n AAG1Subnet --vnet-name aagVnet | jq '.addressPrefix'
"10.0.36.240/28"
`

`[schowdhu@schowdhu-ld3 ~]$ az network application-gateway list -g aag-rg | jq '.[] | .name,.sku,.operationalState'
"aag01"
{
"capacity": 8,
"name": "Standard_Medium",
"tier": "Standard"
}
"Running"
`

Based on the app gw documentation (https://docs.microsoft.com/en-us/azure/application-gateway/configuration-infrastructure#size-of-the-subnet), app gw uses one private IP address per instance, plus another private IP address if a private front-end IP is configured. Azure also reserves five IP addresses in each subnet for internal use: the first four and the last IP addresses. Taking the above example for reference, total available ip addresses in the subnet 10.0.36.240/28 is 16. Azure uses 5 ip addresses and app gw has 8 instances. There should be only 3 ip addresses remaining. However, the `az network vnet subnet list-available-ips` command shown above shows 5 ip addresses available.

https://learn.microsoft.com/en-us/cli/azure/network/vnet/subnet?view=azure-cli-latest#az-network-vnet-subnet-list-available-ips -- This is the example in the documentation. It mentions "List some available ips in the subnet.". Does it mean it shows free ip addresses which are not used yet in the subnet or just it just display a few ip addresses belonging to the subnet irrespective of weather they are being used or not.

Am I missing something here or is there an issue with what the command is showing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.