Azure VMs in a subscription
Lists every virtual machine across a subscription without needing to know resource group names up front. The size, image and networking details live in JSON profile columns; the query extracts the size, which is the field most inventory asks need.
Query
SELECT
name,
location,
provisioning_state,
vm_id,
JSON_EXTRACT(hardware_profile, '$.vmSize') as vm_size,
tags
FROM azure.compute.virtual_machines
WHERE subscription_id = '{{subscription_id}}';
Variation: scoped to one resource group
SELECT name, location, provisioning_state, vm_id
FROM azure.compute.virtual_machines
WHERE subscription_id = '{{subscription_id}}'
AND resource_group_name = 'my-resource-group';
Notes
Filtering by subscription_id alone routes to the list-all operation; adding resource_group_name narrows it to a group. provisioning_state describes the control-plane deployment, not whether the machine is running - the power state comes from the per-VM instance view rather than the list response, so a VM reading Succeeded here may still be stopped. The profile columns (hardware_profile, storage_profile, os_profile, network_profile) are JSON objects: extract the size with JSON_EXTRACT(hardware_profile, '$.vmSize') and the image with JSON_EXTRACT(storage_profile, '$.imageReference.sku'). An empty result means the subscription has no VMs, which is a valid answer rather than a failure.