An Azure data analytics service for real-time analysis on large volumes of data streaming from sources including applications, websites, and internet of things devices.
Hey Tengku, you can definitely get a count of which IPs are currently in use in a given subnet by running a KQL query against Azure Resource Graph (ARG) or your Log Analytics workspace. Below is an example using ARG in the Azure Portal’s Resource Graph Explorer. You’ll just need to plug in your subnet’s full resource-ID:
Sample KQL (Resource Graph)
let targetSubnet = '/subscriptions/<subID>/resourceGroups/<rgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName>';
resources
| where type == 'microsoft.network/networkinterfaces'
| mv-expand ipConfig = properties.ipConfigurations
| where ipConfig.properties.subnet.id == targetSubnet
| project nic = name, ipAddress = ipConfig.properties.privateIPAddress
| summarize usedIPCount = dcount(ipAddress), usedIPs = make_set(ipAddress)
What this does:
• Filters all NICs to only those attached to your subnet
• Extracts each private IP assigned on those NICs
• Shows you how many unique IPs are in use (usedIPCount) and the actual list (usedIPs)
If you want a straight count of active IPs:
| summarize usedIPCount = dcount(ipAddress)
Hope that helps!
—
Reference docs
- Plan IP addressing for AKS clusters (Azure CNI sizing) https://docs.microsoft.com/azure/aks/configure-azure-cni#plan-ip-addressing-for-your-cluster
- Delegate and troubleshoot subnet for AKS https://docs.microsoft.com/azure/aks/troubleshooting#im-getting-an-insufficientsubnetsize-error-while-deploying-an-aks-cluster-with-advanced-networking-what-should-i-do
Let me know:
- Are you running this in Resource Graph or in a Log Analytics workspace?
- Do you have the full subnet resource-ID handy?
- Is your cluster using Azure CNI or kubenet?