Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewmatveychuk/019106dd6c6a1f5232dd8b2c939750eb to your computer and use it in GitHub Desktop.
Save andrewmatveychuk/019106dd6c6a1f5232dd8b2c939750eb to your computer and use it in GitHub Desktop.
Get the list of Windows Server Azure VMs with Azure Hybrid Benefit enabled and group them by VM size
resources
| where type =~ 'microsoft.compute/virtualmachines'
and tostring(properties.storageProfile.imageReference.publisher) =~ 'MicrosoftWindowsServer'
and tostring(properties.['licenseType']) == 'Windows_Server'
| summarize Count=count(type) by VMSize = tostring(properties.hardwareProfile.vmSize)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment