Subnet-driven deployment

Azure Public Test Date Azure Public Test Result

Azure US Gov Last Test Date Azure US Gov Last Test Result

Best Practice Check Cred Scan Check

This template creates an environment with multiple subnets and the servers (one DC and two members) associated with. If the number of subnets varies, the servers are adjusted automatically.

The purpose of this template is to illustrate:

  • Use of array structures in order to maximize the reuse of the linked templates.

    • Subnet definition inside the vNet is done this way

    • The Window server template (WinServ.json) can accommodate any number of data disks because it receives them as a parameter

  • Use of outputs to get back unique IDs such as storage (instead of passing them as parameters).

  • A single template for all domain controllers. The CreateADC template with indx=0 creates the forest, with indx!=0 will add domain controllers.

  • Custom script extensions usage: Each server has chocolatey installed, in order to get diagnostics tools installed quickly, without changing IE protected mode, if the need arises.

  • BGinfo extension is installed on both domain controllers and member servers.

Changelog summary


  • A couple of dependancies optimizations (inspired by Simon's Sharepoint HA template, a must-see). Better decomposition of the templates.

  • Simplified parameters in the azuredeploy template. Internal names (such as VNet, loadbalancers) are generated automatically

  • New parameters

    • Number of subnets (no need to change the subnets array in the variables section anymore)

    • Number of member servers per subnet parameter added.

  • Premium storage option, for thoses who are in a hurry.


  • A minimum of two subnets is needed for this template to work

  • Distinction of the PDC from the BDCs when calling the DSC template (ConfigDC.json), is done by leveraging the function (n+2)%(n+1), which returns 0 if n==0, 1 if not. The suffix is appended to the base DSC function name, branching effectively between the two DSC configurations (CrateADC_0 & CreateADC_1)

  • If premium storage option is selected, the VMs are DS series

  • Created subnets are C class (==> 172.16.X.0/24)

Deploying the template

Deploy To Azure Deploy To Azure US Gov Visualize


adminPasswordAdmin password
adminUsernameAdmin username
assetLocationThe location of resources such as templates and DSC modules that the script is dependent templates/master/301-subnet-driven-deployment/
dnsLabelPrefixUnique public DNS label for the deployment. The fqdn will look something like ''. Up to 62 chars, digits or dashes, lo wercase, should start with a letter: must conform to '^[a-z][a-z0-9-]{1,61}[a-z0-9]$'.
domainNameDomain to create for the
memberServersPerSubnetMember servers for each subnet. Must be between 1 and 201
storageCategoryStorage type. Can be either Standard (HDD) or Premium (SSD)Standard

Tags: Microsoft.Resources/deployments, Microsoft.Compute/availabilitySets, Microsoft.Compute/virtualMachines/extensions, JsonADDomainExtension, DSC, Microsoft.Network/loadBalancers, Microsoft.Network/publicIPAddresses, Microsoft.Network/virtualNetworks, Microsoft.Storage/storageAccounts, Microsoft.Network/loadBalancers/inboundNatRules, Microsoft.Network/networkInterfaces, Microsoft.Compute/virtualMachines, BGInfo, CustomScriptExtension