Skip to main content
selectMicrosoft Azurelast verified 2026-07-30
Servicesnetwork
CredentialsAZURE_TENANT_ID AZURE_CLIENT_ID AZURE_CLIENT_SECRET
PermissionsMicrosoft.Network/virtualNetworks/read
Fan-out: subscription - one call per subscription when swept tenant-wide.

Azure virtual network and subnet provisioning

Lists the virtual networks in a resource group with their address space, and covers creating a vnet and a subnet inside it. The subnet is what a network interface - and therefore a VM - attaches to, so this is the prerequisite for any compute provisioning.

Query

SELECT name, location, provisioning_state, address_space
FROM azure.network.virtual_networks
WHERE subscription_id = '{{subscription_id}}'
AND resource_group_name = '{{resource_group_name}}';

Creating a virtual network

INSERT INTO azure.network.virtual_networks(
virtual_network_name,
resource_group_name,
subscription_id,
location,
properties
)
SELECT
'my-vnet',
'{{resource_group_name}}',
'{{subscription_id}}',
'eastus',
'{"addressSpace": {"addressPrefixes": ["10.10.0.0/16"]}}';

Creating a subnet

The subnet is a child resource, so it takes the parent virtual_network_name as well as its own name, and carries no location of its own:

INSERT INTO azure.network.subnets(
subnet_name,
virtual_network_name,
resource_group_name,
subscription_id,
properties
)
SELECT
'my-subnet',
'my-vnet',
'{{resource_group_name}}',
'{{subscription_id}}',
'{"addressPrefix": "10.10.1.0/24"}';

Listing subnets

SELECT name, provisioning_state, address_prefix
FROM azure.network.subnets
WHERE subscription_id = '{{subscription_id}}'
AND resource_group_name = '{{resource_group_name}}'
AND virtual_network_name = 'my-vnet';

Notes

Body properties are plain columns - location and properties - with no data__ prefix; the older data__location form fails with InvalidResource against this provider. The subnet exposes address_prefix as a flattened top-level column on read while taking addressPrefix nested inside properties on write, so the read and write shapes differ. A vnet reports provisioning_state Updating for a short window after a subnet is added, which is normal rather than a failure. Subnets cannot be deleted while anything is attached: removing one that still has a network interface fails with InUseSubnetCannotBeDeleted, so delete dependants first, or delete the whole resource group to cascade. Network interfaces live at azure.network.network_interfaces - note the resource is network_interfaces, not interfaces.

Related queries

  • Azure resource group lifecycle - Lists resource groups in a subscription, and creates or deletes one; the container every other Azure resource lives in.
  • Azure VMs in a subscription - Lists virtual machines across a subscription with name, location, provisioning state and the profiles describing size, image and networking.