How to check core usage of ESU licenses - Azure Arc

Posted by : on

troubleshooting   azure

:bulb: Introduction

This is my first blog post regarding the Azure space! On my blog today, I want to shed light on a common issue customers face: tracking the usage of Cores across their licenses. This is vital for understanding how many Cores are being utilized versus what’s available. Currently, Azure Portal lacks a direct report view for this, forcing customers to manually check each license and linked server to sum up the Core count, which is a hassle.

Good news, though. When a customer asks for such a report, there’s a simpler method: querying the Azure Resource Graph (ARG). The query I’ve got does the heavy lifting. It counts the Cores from each linked Arc machine, adjusts the count to meet the minimum requirements (8 vCores per VM and 16 pCores per physical server), and then presents this data alongside the license info.

This approach is a game-changer. It not only saves time but also gives a more accurate picture of Core usage.

:chart_with_upwards_trend: Steps to Gather Data

:mag: Open Resource Graph Explorer

Within the Azure Portal open Resource Graph Explorer.

Resource Graph Explorer

:memo: Kusto Query (KQL)

resources
| where type =~ "microsoft.hybridcompute/licenses"
| extend sku = tostring(properties.licenseDetails.edition)
| extend totalCores = tostring(properties.licenseDetails.processors)
| extend coreType = case(
    properties.licenseDetails.type =~ 'vCore','Virtual core',
    properties.licenseDetails.type =~ 'pCore','Physical core',
    'Unknown'
)
| extend status = tostring(properties.licenseDetails.state)
| extend licenseId = tolower(tostring(id)) // Depending on what is stored in license profile, might have to get the immutableId instead
| join kind=inner(
    resources
    | where type =~ "microsoft.hybridcompute/machines/licenseProfiles"
    | extend machineId = tolower(tostring(trim_end(@"\/\w+\/(\w|\.)+", id)))
    | extend licenseId = tolower(tostring(properties.esuProfile.assignedLicense))
) on licenseId // Get count of license profile per license, a license profile is created for each machine that is assigned a license
| join kind=inner(
    resources
    | where type =~ "microsoft.hybridcompute/machines"
    | extend machineId = tolower(id)
    | extend coreCount = toint(properties.detectedProperties.coreCount) 
) on machineId // Get core count by machine
    | extend adjustedCoreCount = iff(sku =~ "Standard" 
                                , case(coreCount < 8, 8, coreCount) , 
                                    iff(sku =~ "DataCenter"
                                        , case(coreCount < 16, 16, coreCount)
                                        ,coreCount))  
| extend machineName = tostring(split(machineId, "/")[-1])
| project machineName, machineId, licenseId, name, type, location, subscriptionId, resourceGroup, sku, totalCores, coreType, status, adjustedCoreCount
| summarize UsedCoreCount = sum(adjustedCoreCount) by licenseId, name, type, location, subscriptionId, resourceGroup, sku, totalCores, coreType, status

Azure Arc ESU licenses used

Page Views


Share on:
About Blake Drumm
Blake Drumm

I like to collaborate and work on projects. My skills with Powershell allow me to quickly develop automated solutions to suit my customers, and my own needs.

Email :

Website :

About Blake Drumm

My name is Blake Drumm, I am working on the Azure Monitoring Enterprise Team with Microsoft. Currently working to update public documentation for System Center products and write troubleshooting guides to assist with fixing issues that may arise while using the products. I like to blog on Operations Manager and Azure Automation products, keep checking back for new posts. My goal is to post atleast once a month if possible.

Follow @blakedrumm
Useful Links