title: KQL to identify which vm has CustomScript extension
body: <p>I want how many and what VMs have &quot;CustomScript&quot;extension enabled along with the “properties” of that extensions and I have tried this query but didn't extract the custom-extension</p>
  <pre><code>      Resources
        | where type == 'microsoft.compute/virtualmachines'
        |         extend
        JoinID = toupper(id),
         OSName = tostring(properties.osProfile.computerName),
  OSType = tostring(properties.storageProfile.osDisk.osType),
  VMSize = tostring(properties.hardwareProfile.vmSize)
        | join kind=leftouter(
  Resources
  | where type == 'microsoft.compute/virtualmachines/extensions'
  | extend
      VMId = toupper(substring(id, 0, indexof(id, '/extensions'))),
      ExtensionName =~ 'custom-script'
      ) on $left.JoinID == $right.VMId
      | top 5 by name asc
  </code></pre>