{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "vnetLocation": { "type": "string", "metadata": { "description": "Location for all Vnets" } }, "vnetCount": { "type": "int", "metadata": { "description": "Number of Vnets to create" } }, "vnetNamePrefix": { "type": "string", "metadata": { "description": "Prefix for the Vnet names" } }, "vnetAddressSpacePrefix": { "type": "string", "metadata": { "description": "Base address space prefix for Vnets (e.g., '10.0')" } }, "subnetCount": { "type": "int", "metadata": { "description": "Number of Subnets to create per Vnet" } }, "subnetNamePrefix": { "type": "string", "metadata": { "description": "Prefix for the Subnet names" } } }, "resources": [ { "type": "Microsoft.Network/virtualNetworks", "apiVersion": "2023-04-01", "location": "[parameters('vnetLocation')]", "copy": { "name": "vnetCopy", "count": "[parameters('vnetCount')]", "mode": "serial", "batchSize": 1 }, "name": "[concat(parameters('vnetNamePrefix'), copyIndex('vnetCopy'))]", "properties": { "addressSpace": { "addressPrefixes": [ "[concat(parameters('vnetAddressSpacePrefix'), '.', copyIndex('vnetCopy'), '.0.0/16')]" ] }, "subnets": [ { "copy": { "name": "subnetCopy", "count": "[parameters('subnetCount')]", "mode": "serial", "batchSize": 1 }, "input": [ { "name": "[concat(parameters('subnetNamePrefix'), copyIndex('subnetCopy'))]", "properties": { "addressPrefix": "[concat(parameters('vnetAddressSpacePrefix'), '.', copyIndex('vnetCopy'), '.', copyIndex('subnetCopy'), '.0/24')]" } } ] } ] } } ] }