{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "newStorageAccountName": { "type": "string", "metadata": { "description": "The name of the new storage account created to store the VMs disks" } }, "storageAccountType": { "type": "string", "allowedValues": [ "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS" ], "metadata": { "description": "The type of the Storage Account created" }, "defaultValue": "Standard_LRS" }, "location": { "type": "string", "allowedValues": [ "West US", "East US", "West Europe", "East Asia", "Southeast Asia" ], "metadata": { "description": "The region to deploy the resources into" } }, "virtualNetworkName": { "type": "string", "metadata": { "description": "The name of the Virtual Network to Create" }, "defaultValue": "adVNET" }, "virtualNetworkAddressRange": { "type": "string", "metadata": { "description": "The address range of the new VNET in CIDR format" }, "defaultValue": "10.0.0.0/16" }, "adSubnetName": { "type": "string", "metadata": { "description": "The name of the subnet created in the new VNET" }, "defaultValue": "adSubnet" }, "adSubnet": { "type": "string", "metadata": { "description": "The address range of the subnet created in the new VNET" }, "defaultValue": "10.0.0.0/24" }, "adPDCNicName": { "type": "string", "metadata": { "description": "The name of the NIC attached to the new PDC" }, "defaultValue": "adPDCNic" }, "adPDCNicIPAddress": { "type": "string", "metadata": { "description": "The IP address of the new AD PDC" }, "defaultValue": "10.0.0.4" }, "adBDCNicName": { "type": "string", "metadata": { "description": "The name of the NIC attached to the new BDC" }, "defaultValue": "adBDCNic" }, "adBDCNicIPAddress": { "type": "string", "metadata": { "description": "The IP address of the new AD BDC" }, "defaultValue": "10.0.0.5" }, "publicIPAddressName": { "type": "string", "metadata": { "description": "The name of the public IP address used by the Load Balancer" }, "defaultValue": "adpublicIP" }, "publicIPAddressType": { "type": "string", "allowedValues": [ "Dynamic", "Static" ], "metadata": { "description": "The type of the public IP address used by the Load Balancer" }, "defaultValue": "Dynamic" }, "adPDCVMName": { "type": "string", "metadata": { "description": "The computer name of the PDC" }, "defaultValue": "adPDC" }, "adBDCVMName": { "type": "string", "metadata": { "description": "The computer name of the BDC" }, "defaultValue": "adBDC" }, "adminUsername": { "type": "string", "metadata": { "description": "The name of the Administrator of the new VM and Domain" }, "defaultValue": "adAdministrator" }, "adminPassword": { "type": "securestring", "metadata": { "description": "The password for the Administrator account of the new VM and Domain" } }, "adVMSize": { "type": "string", "allowedValues": [ "Standard_D1", "Standard_DS1", "Standard_D2", "Standard_DS2", "Standard_D3", "Standard_DS3", "Standard_D4", "Standard_DS4", "Standard_D11", "Standard_DS11", "Standard_D12", "Standard_DS12", "Standard_D13", "Standard_DS13", "Standard_D14", "Standard_DS14" ], "metadata": { "description": "The size of the VM Created" }, "defaultValue": "Standard_D2" }, "imagePublisher": { "type": "string", "defaultValue": "MicrosoftWindowsServer", "metadata": { "description": "Image Publisher" } }, "imageOffer": { "type": "string", "defaultValue": "WindowsServer", "metadata": { "description": "Image Offer" } }, "imageSKU": { "type": "string", "defaultValue": "2012-R2-Datacenter", "metadata": { "description": "Image SKU" } }, "adAvailabilitySetName": { "type": "string", "metadata": { "description": "The name of the availability set that the AD VM is created in" }, "defaultValue": "adAvailabiltySet" }, "domainName": { "type": "string", "metadata": { "description": "The FQDN of the AD Domain created " }, "defaultValue": "adarmtest.com" }, "dnsPrefix": { "type": "string", "metadata": { "description": "The DNS prefix for the public IP address used by the Load Balancer" } }, "pdcRDPPort": { "type": "int", "metadata": { "description": "The public RDP port for the PDC VM" }, "defaultValue": 3389 }, "bdcRDPPort": { "type": "int", "metadata": { "description": "The public RDP port for the BDC VM" }, "defaultValue": 13389 }, "AssetLocation": { "type": "string", "metadata": { "description": "The location of resources such as templates and DSC modules that the script is dependent" }, "defaultValue": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/active-directory-new-domain-ha-2-dc" } }, "variables": { "adLBFE": "LBFE", "adLBBE": "LBBE", "adPDCRDPNAT": "adPDCRDP", "adBDCRDPNAT": "adBDCRDP", "VnetID": "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", "adSubnetRef": "[concat(variables('VnetID'),'/subnets/',parameters('adSubnetName'))]", "adPDCNicId": "[resourceId('Microsoft.Network/networkInterfaces',parameters('adPDCNicName'))]", "adPDCIPConfigID": "[concat(variables('adPDCNicId'),'/ipConfigurations/ipconfig1')]", "adBDCNicId": "[resourceId('Microsoft.Network/networkInterfaces',parameters('adBDCNicName'))]", "adBDCIPConfigID": "[concat(variables('adBDCNicId'),'/ipConfigurations/ipconfig1')]", "adLBName": "adLoadBalancer", "adlbID": "[resourceId('Microsoft.Network/loadBalancers',variables('adLBName'))]", "adlbFEConfigID": "[concat(variables('adlbID'),'/frontendIPConfigurations/',variables('adLBFE'))]", "adPDCRDPNATRuleID": "[concat(variables('adlbID'),'/inboundNatRules/',variables('adPDCRDPNAT'))]", "adBDCRDPNATRuleID": "[concat(variables('adlbID'),'/inboundNatRules/',variables('adBDCRDPNAT'))]", "adBEAddressPoolID": "[concat(variables('adlbID'),'/backendAddressPools/',variables('adLBBE'))]", "adPDCDataDisk": "ADPDCDataDisk", "adBDCDataDisk": "ADBDCDataDisk", "adDataDiskSize": 1000, "vnetTemplateUri": "[concat(parameters('AssetLocation'),'/vnet.json')]", "nicTemplateUri": "[concat(parameters('AssetLocation'),'/nic.json')]", "vnetwithDNSTemplateUri": "[concat(parameters('AssetLocation'),'/vnet-with-dns-server.json')]", "adPDCModulesURL": "[concat(parameters('AssetLocation'),'/CreateADPDC.ps1.zip')]", "adPDCConfigurationFunction": "CreateADPDC.ps1\\CreateADPDC", "adBDCModulesURL": "[concat(parameters('AssetLocation'),'/CreateADBDC.ps1.zip')]", "adBDCConfigurationFunction": "CreateADBDC.ps1\\CreateADBDC" }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "name": "[parameters('newStorageAccountName')]", "apiVersion": "2015-05-01-preview", "location": "[parameters('location')]", "properties": { "accountType": "[parameters('storageAccountType')]" } }, { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Network/publicIPAddresses", "name": "[parameters('publicIPAddressName')]", "location": "[parameters('location')]", "properties": { "publicIPAllocationMethod": "[parameters('publicIPAddressType')]", "dnsSettings": { "domainNameLabel": "[parameters('dnsPrefix')]" } } }, { "type": "Microsoft.Compute/availabilitySets", "name": "[parameters('adAvailabilitySetName')]", "apiVersion": "2015-05-01-preview", "location": "[parameters('location')]" }, { "name": "VNet", "type": "Microsoft.Resources/deployments", "apiVersion": "2015-01-01", "properties": { "mode": "Incremental", "templateLink": { "uri": "[variables('vnetTemplateUri')]", "contentVersion": "1.0.0.0" }, "parameters": { "location": { "value": "[parameters('location')]" }, "virtualNetworkName": { "value": "[parameters('virtualNetworkName')]" }, "virtualNetworkAddressRange": { "value": "[parameters('virtualNetworkAddressRange')]" }, "subnetName": { "value": "[parameters('adSubnetName')]" }, "subnetRange": { "value": "[parameters('adSubnet')]" } } } }, { "apiVersion": "2015-05-01-preview", "name": "[variables('adLBName')]", "type": "Microsoft.Network/loadBalancers", "location": "[parameters('location')]", "dependsOn": [ "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]" ], "properties": { "frontendIPConfigurations": [ { "name": "[variables('adLBFE')]", "properties": { "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]" } } } ], "backendAddressPools": [ { "name": "[variables('adLBBE')]" } ], "inboundNatRules": [ { "name": "[variables('adPDCRDPNAT')]", "properties": { "frontendIPConfiguration": { "id": "[variables('adlbFEConfigID')]" }, "protocol": "tcp", "frontendPort": "[parameters('pdcRDPPort')]", "backendPort": 3389, "enableFloatingIP": false } }, { "name": "[variables('adBDCRDPNAT')]", "properties": { "frontendIPConfiguration": { "id": "[variables('adlbFEConfigID')]" }, "protocol": "tcp", "frontendPort": "[parameters('bdcRDPPort')]", "backendPort": 3389, "enableFloatingIP": false } } ] } }, { "name": "[parameters('adPDCNicName')]", "type": "Microsoft.Network/networkInterfaces", "location": "[parameters('location')]", "dependsOn": [ "Microsoft.Resources/deployments/VNet", "[concat('Microsoft.Network/loadBalancers/',variables('adLBName'))]" ], "apiVersion": "2015-05-01-preview", "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Static", "privateIPAddress": "[parameters('adPDCNicIPAddress')]", "subnet": { "id": "[variables('adSubnetRef')]" }, "loadBalancerBackendAddressPools": [ { "id": "[variables('adBEAddressPoolID')]" } ], "loadBalancerInboundNatRules": [ { "id": "[variables('adPDCRDPNATRuleID')]" } ] } } ] } }, { "name": "[parameters('adBDCNicName')]", "type": "Microsoft.Network/networkInterfaces", "location": "[parameters('location')]", "dependsOn": [ "Microsoft.Resources/deployments/VNet", "[concat('Microsoft.Network/loadBalancers/',variables('adLBName'))]" ], "apiVersion": "2015-05-01-preview", "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Static", "privateIPAddress": "[parameters('adBDCNicIPAddress')]", "subnet": { "id": "[variables('adSubnetRef')]" }, "loadBalancerBackendAddressPools": [ { "id": "[variables('adBEAddressPoolID')]" } ], "loadBalancerInboundNatRules": [ { "id": "[variables('adBDCRDPNATRuleID')]" } ] } } ] } }, { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Compute/virtualMachines", "name": "[parameters('adPDCVMName')]", "location": "[parameters('location')]", "dependsOn": [ "[resourceId('Microsoft.Storage/storageAccounts',parameters('newStorageAccountName'))]", "[resourceId('Microsoft.Network/networkInterfaces',parameters('adPDCNicName'))]", "[resourceId('Microsoft.Compute/availabilitySets', parameters('adAvailabilitySetName'))]", "[resourceId('Microsoft.Network/loadBalancers',variables('adLBName'))]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('adVMSize')]" }, "availabilitySet": { "id": "[resourceId('Microsoft.Compute/availabilitySets', parameters('adAvailabilitySetName'))]" }, "osProfile": { "computername": "[parameters('adPDCVMName')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]" }, "storageProfile": { "imageReference": { "publisher": "[parameters('imagePublisher')]", "offer": "[parameters('imageOffer')]", "sku": "[parameters('imageSKU')]", "version": "latest" }, "osDisk": { "name": "osdisk", "vhd": { "uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/vhds0/','osdisk.vhd')]" }, "caching": "ReadWrite", "createOption": "FromImage" }, "dataDisks": [ { "vhd": { "uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/vhds0/', variables('adPDCDataDisk'),'-1.vhd')]" }, "name": "[concat(parameters('adPDCVMName'),'-data-disk1')]", "caching": "None", "diskSizeGB": "[variables('adDataDiskSize')]", "lun": 0, "createOption": "empty" } ] }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('adPDCNicName'))]" } ] } }, "resources": [ { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(parameters('adPDCVMName'),'/CreateADForest')]", "apiVersion": "2015-05-01-preview", "location": "[parameters('location')]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines', parameters('adPDCVMName'))]" ], "properties": { "publisher": "Microsoft.Powershell", "type": "DSC", "typeHandlerVersion": "1.7", "settings": { "ModulesUrl": "[variables('adPDCModulesURL')]", "ConfigurationFunction": "[variables('adPDCConfigurationFunction')]", "Properties": { "DomainName": "[parameters('domainName')]", "AdminCreds": { "UserName": "[parameters('adminUserName')]", "Password": "PrivateSettingsRef:AdminPassword" } } }, "protectedSettings": { "Items": { "AdminPassword": "[parameters('adminPassword')]" } } } } ] }, { "name": "UpdateVNetDNS1", "type": "Microsoft.Resources/deployments", "apiVersion": "2015-01-01", "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/', parameters('adPDCVMName'),'/extensions/CreateADForest')]" ], "properties": { "mode": "Incremental", "templateLink": { "uri": "[variables('vnetwithDNSTemplateUri')]", "contentVersion": "1.0.0.0" }, "parameters": { "location": { "value": "[parameters('location')]" }, "virtualNetworkName": { "value": "[parameters('virtualNetworkName')]" }, "virtualNetworkAddressRange": { "value": "[parameters('virtualNetworkAddressRange')]" }, "subnetName": { "value": "[parameters('adSubnetName')]" }, "subnetRange": { "value": "[parameters('adSubnet')]" }, "DNSServerAddress": { "value": [ "[parameters('adPDCNicIPAddress')]" ] } } } }, { "name": "UpdateBDCNIC", "type": "Microsoft.Resources/deployments", "apiVersion": "2015-01-01", "dependsOn": [ "Microsoft.Resources/deployments/UpdateVNetDNS1" ], "properties": { "mode": "Incremental", "templateLink": { "uri": "[variables('nicTemplateUri')]", "contentVersion": "1.0.0.0" }, "parameters": { "location": { "value": "[parameters('location')]" }, "nicName": { "value": "[parameters('adBDCNicName')]" }, "ipConfigurations": { "value": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Static", "privateIPAddress": "[parameters('adBDCNicIPAddress')]", "subnet": { "id": "[variables('adSubnetRef')]" }, "loadBalancerBackendAddressPools": [ { "id": "[variables('adBEAddressPoolID')]" } ], "loadBalancerInboundNatRules": [ { "id": "[variables('adBDCRDPNATRuleID')]" } ] } } ] }, "dnsServers": { "value": [ "[parameters('adPDCNicIPAddress')]" ] } } } }, { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Compute/virtualMachines", "name": "[parameters('adBDCVMName')]", "location": "[parameters('location')]", "dependsOn": [ "[resourceId('Microsoft.Storage/storageAccounts',parameters('newStorageAccountName'))]", "[resourceId('Microsoft.Network/networkInterfaces',parameters('adBDCNicName'))]", "[resourceId('Microsoft.Compute/availabilitySets', parameters('adAvailabilitySetName'))]", "[resourceId('Microsoft.Network/loadBalancers',variables('adLBName'))]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('adVMSize')]" }, "availabilitySet": { "id": "[resourceId('Microsoft.Compute/availabilitySets', parameters('adAvailabilitySetName'))]" }, "osProfile": { "computername": "[parameters('adBDCVMName')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]" }, "storageProfile": { "imageReference": { "publisher": "[parameters('imagePublisher')]", "offer": "[parameters('imageOffer')]", "sku": "[parameters('imageSKU')]", "version": "latest" }, "osDisk": { "name": "osdisk", "vhd": { "uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/vhds1/','osdisk.vhd')]" }, "caching": "ReadWrite", "createOption": "FromImage" }, "dataDisks": [ { "vhd": { "uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/vhds1/', variables('adBDCDataDisk'),'-1.vhd')]" }, "name": "[concat(parameters('adBDCVMName'),'-data-disk1')]", "caching": "None", "diskSizeGB": "[variables('adDataDiskSize')]", "lun": 0, "createOption": "empty" } ] }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('adBDCNicName'))]" } ] } } }, { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(parameters('adBDCVMName'),'/CreateBDC')]", "apiVersion": "2015-05-01-preview", "location": "[parameters('location')]", "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/', parameters('adBDCVMName'))]", "Microsoft.Resources/deployments/UpdateBDCNIC" ], "properties": { "publisher": "Microsoft.Powershell", "type": "DSC", "typeHandlerVersion": "1.7", "settings": { "ModulesUrl": "[variables('adBDCModulesURL')]", "ConfigurationFunction": "[variables('adBDCConfigurationFunction')]", "Properties": { "DomainName": "[parameters('domainName')]", "AdminCreds": { "UserName": "[parameters('adminUserName')]", "Password": "PrivateSettingsRef:AdminPassword" } } }, "protectedSettings": { "Items": { "AdminPassword": "[parameters('adminPassword')]" } } } }, { "name": "UpdateVNetDNS2", "type": "Microsoft.Resources/deployments", "apiVersion": "2015-01-01", "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/',parameters('adBDCVMName'),'/extensions/CreateBDC')]" ], "properties": { "mode": "Incremental", "templateLink": { "uri": "[variables('vnetwithDNSTemplateUri')]", "contentVersion": "1.0.0.0" }, "parameters": { "location": { "value": "[parameters('location')]" }, "virtualNetworkName": { "value": "[parameters('virtualNetworkName')]" }, "virtualNetworkAddressRange": { "value": "[parameters('virtualNetworkAddressRange')]" }, "subnetName": { "value": "[parameters('adSubnetName')]" }, "subnetRange": { "value": "[parameters('adSubnet')]" }, "DNSServerAddress": { "value": [ "[parameters('adPDCNicIPAddress')]", "[parameters('adBDCNicIPAddress')]" ] } } } } ] }