Share via

Delegated subnet IP Usage KQL

Tengku Aiman 0 Reputation points
2026-03-25T00:13:14.7933333+00:00

Hello, I have a trouble in finding a IP usage in a subnet using KQL, can I get some help on that?

Azure Data Explorer
Azure Data Explorer

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.


1 answer

Sort by: Most helpful
  1. Smaran Thoomu 35,035 Reputation points Microsoft External Staff Moderator
    2026-03-26T04:42:26.9966667+00:00

    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

    1. Plan IP addressing for AKS clusters (Azure CNI sizing) https://docs.microsoft.com/azure/aks/configure-azure-cni#plan-ip-addressing-for-your-cluster
    2. 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?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.