Answer accepted by question author
Yes you are understanding the recommendation correctly, and yes β you will still need a custom table for historical correlation.
- VMSS-based lookups are only valid while the VMSS exists
- Once a Batch pool is deleted (and its VMSS is torn down), Log Analytics retains Perf data but loses the controlβplane context
- Therefore, the correct and supported approach is:
- Use resourceTags on the Batch pool to discover the VMSS while it exists
- Extract VMSS name β Pool name
- Persist that mapping into a custom Log Analytics table
- Join historical Perf._ResourceId against that table
You did not miss any important steps.
This behavior is by design and not specific to AMA.
- Azure Batch deliberately abstracts away the underlying infrastructure
- The Batch control plane never exposes VMSS identity via azure-mgmt-batch
- Azure Monitor (AMA) reports telemetry at the VM / VMSS layer, not the Batch layer
- Once a VMSS is deleted:
- Azure Resource Graph
- ARM
- Compute APIs no longer contain metadata
- Log Analytics keeps Perf rows, but ResourceId becomes the only remaining anchor
There is currently no native field in Perf that stores the Batch pool name, nor is there a supported way to backfill that automatically after deletion.
Tag the Batch pool (control plane)
When creating the pool, set resourceTags:
pool_params = Pool(
...
resource_tags={
"BatchPoolName": pool_name,
"BatchAccountName": batch_account_name
},
...
)
Discover VMSS while it exists
Query Compute / ARM to find VMSS with that tag:
Tags["BatchPoolName"] == "<pool-name>"
Query historical Perf data reliably
Because _ResourceId is retained forever in Perf:
let PoolMap = BatchPoolRegistry_CL
| project PoolName, VmssResourceIdPrefix;
Perf
| where ObjectName == "Processor"
| where CounterName == "% Processor Time"
| extend VmssPrefix = extract(@"virtualMachineScaleSets/([^/]+)", 1, _ResourceId)
| join kind=leftouter PoolMap on $left.VmssPrefix == $right.VmssName
| summarize avg(CounterValue) by PoolName, bin(TimeGenerated, 5m)
Your understanding is exactly correct. The VMSS-based correlation works only while the backing infrastructure exists. For historical analysis, the supported pattern is to materialize the VMSS β Batch pool association at pool creation time and persist it into a custom Log Analytics table, then join against the _ResourceId column in Perf.
Thanks,
Manish.
-
Manish Deshpande 7,010 Reputation points β’ Microsoft External Staff β’ Moderator
Hello @Francesco Cipolla
I have posted my response it would be of great help if you could accept the response and upvote it.
Thanks,
Manish
Sign in to comment
