Created
September 3, 2019 23:32
-
-
Save signalwarrant/f38df3f8733345195df52931fd51f23a to your computer and use it in GitHub Desktop.
new-ADDomain ARM Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "parameters": { | |
| "adminUsername": { | |
| "type": "string", | |
| "metadata": { | |
| "description": "The name of the administrator account of the new VM and domain" | |
| } | |
| }, | |
| "adminPassword": { | |
| "type": "securestring", | |
| "metadata": { | |
| "description": "The password for the administrator account of the new VM and domain" | |
| } | |
| }, | |
| "domainName": { | |
| "type": "string", | |
| "metadata": { | |
| "description": "The FQDN of the Active Directory Domain to be created" | |
| } | |
| }, | |
| "dnsPrefix": { | |
| "type": "string", | |
| "metadata": { | |
| "description": "The DNS prefix for the public IP address used by the Load Balancer" | |
| } | |
| }, | |
| "vmSize": { | |
| "type": "string", | |
| "defaultValue": "Standard_B2s", | |
| "metadata": { | |
| "description": "Size of the VM for the controller" | |
| } | |
| }, | |
| "_artifactsLocation": { | |
| "type": "string", | |
| "metadata": { | |
| "description": "The location of resources, such as templates and DSC modules, that the template depends on" | |
| }, | |
| "defaultValue": "[deployment().properties.templateLink.uri]" | |
| }, | |
| "_artifactsLocationSasToken": { | |
| "type": "securestring", | |
| "metadata": { | |
| "description": "Auto-generated token to access _artifactsLocation" | |
| }, | |
| "defaultValue": "" | |
| }, | |
| "location": { | |
| "type": "string", | |
| "defaultValue": "[resourceGroup().location]", | |
| "metadata": { | |
| "description": "Location for all resources." | |
| } | |
| } | |
| }, | |
| "variables": { | |
| "virtualNetworkName": "adVNET", | |
| "virtualNetworkAddressRange": "10.0.0.0/16", | |
| "adLBFE": "LBFE", | |
| "adLBBE": "LBBE", | |
| "adRDPNAT": "adRDP", | |
| "adNicName": "adNic", | |
| "adNicIPAddress": "10.0.0.4", | |
| "adVMName": "adVM", | |
| "adSubnetName": "adSubnet", | |
| "adSubnetAddressPrefix": "10.0.0.0/24", | |
| "publicIPAddressName": "adPublicIP", | |
| "adAvailabilitySetName": "adAvailabiltySet", | |
| "adLBName": "adLoadBalancer" | |
| }, | |
| "resources": [ | |
| { | |
| "type": "Microsoft.Network/publicIPAddresses", | |
| "apiVersion": "2019-02-01", | |
| "name": "[variables('publicIPAddressName')]", | |
| "location": "[parameters('location')]", | |
| "properties": { | |
| "publicIPAllocationMethod": "Static", | |
| "dnsSettings": { | |
| "domainNameLabel": "[parameters('dnsPrefix')]" | |
| } | |
| } | |
| }, | |
| { | |
| "type": "Microsoft.Compute/availabilitySets", | |
| "apiVersion": "2019-03-01", | |
| "location": "[parameters('location')]", | |
| "name": "[variables('adAvailabilitySetName')]", | |
| "properties": { | |
| "PlatformUpdateDomainCount": 20, | |
| "PlatformFaultDomainCount": 2 | |
| }, | |
| "sku": { | |
| "name": "Aligned" | |
| } | |
| }, | |
| { | |
| "type": "Microsoft.Resources/deployments", | |
| "apiVersion": "2018-11-01", | |
| "name": "VNet", | |
| "properties": { | |
| "mode": "Incremental", | |
| "templateLink": { | |
| "uri": "[uri(parameters('_artifactsLocation'), concat('nestedtemplates/vnet.json', parameters('_artifactsLocationSasToken')))]", | |
| "contentVersion": "1.0.0.0" | |
| }, | |
| "parameters": { | |
| "virtualNetworkName": { | |
| "value": "[variables('virtualNetworkName')]" | |
| }, | |
| "virtualNetworkAddressRange": { | |
| "value": "[variables('virtualNetworkAddressRange')]" | |
| }, | |
| "subnetName": { | |
| "value": "[variables('adSubnetName')]" | |
| }, | |
| "subnetRange": { | |
| "value": "[variables('adSubnetAddressPrefix')]" | |
| }, | |
| "location": { | |
| "value": "[parameters('location')]" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "type": "Microsoft.Network/loadBalancers", | |
| "apiVersion": "2019-02-01", | |
| "name": "[variables('adLBName')]", | |
| "location": "[parameters('location')]", | |
| "dependsOn": [ | |
| "[variables('publicIPAddressName')]" | |
| ], | |
| "properties": { | |
| "frontendIPConfigurations": [ | |
| { | |
| "name": "[variables('adLBFE')]", | |
| "properties": { | |
| "publicIPAddress": { | |
| "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]" | |
| } | |
| } | |
| } | |
| ], | |
| "backendAddressPools": [ | |
| { | |
| "name": "[variables('adLBBE')]" | |
| } | |
| ], | |
| "inboundNatRules": [ | |
| { | |
| "name": "[variables('adRDPNAT')]", | |
| "properties": { | |
| "frontendIPConfiguration": { | |
| "id": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', variables('adLBName'), variables('adLBFE'))]" | |
| }, | |
| "protocol": "Tcp", | |
| "frontendPort": 3389, | |
| "backendPort": 3389, | |
| "enableFloatingIP": false | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "type": "Microsoft.Network/networkInterfaces", | |
| "apiVersion": "2019-02-01", | |
| "name": "[variables('adNicName')]", | |
| "location": "[parameters('location')]", | |
| "dependsOn": [ | |
| "VNet", | |
| "[variables('adLBName')]" | |
| ], | |
| "properties": { | |
| "ipConfigurations": [ | |
| { | |
| "name": "ipconfig1", | |
| "properties": { | |
| "privateIPAllocationMethod": "Static", | |
| "privateIPAddress": "[variables('adNicIPAddress')]", | |
| "subnet": { | |
| "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('adSubnetName'))]" | |
| }, | |
| "loadBalancerBackendAddressPools": [ | |
| { | |
| "id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('adLBName'), variables('adLBBE'))]" | |
| } | |
| ], | |
| "loadBalancerInboundNatRules": [ | |
| { | |
| "id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatRules', variables('adLBName'), variables('adRDPNAT'))]" | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "type": "Microsoft.Compute/virtualMachines", | |
| "apiVersion": "2019-03-01", | |
| "name": "[variables('adVMName')]", | |
| "location": "[parameters('location')]", | |
| "dependsOn": [ | |
| "[variables('adNicName')]", | |
| "[variables('adAvailabilitySetName')]", | |
| "[variables('adLBName')]" | |
| ], | |
| "properties": { | |
| "hardwareProfile": { | |
| "vmSize": "[parameters('vmSize')]" | |
| }, | |
| "availabilitySet": { | |
| "id": "[resourceId('Microsoft.Compute/availabilitySets', variables('adAvailabilitySetName'))]" | |
| }, | |
| "osProfile": { | |
| "computerName": "[variables('adVMName')]", | |
| "adminUsername": "[parameters('adminUsername')]", | |
| "adminPassword": "[parameters('adminPassword')]" | |
| }, | |
| "storageProfile": { | |
| "imageReference": { | |
| "publisher": "MicrosoftWindowsServer", | |
| "offer": "WindowsServer", | |
| "sku": "2019-Datacenter", | |
| "version": "latest" | |
| }, | |
| "osDisk": { | |
| "name": "[concat(variables('adVMName'),'_OSDisk')]", | |
| "caching": "ReadOnly", | |
| "createOption": "FromImage", | |
| "managedDisk": { | |
| "storageAccountType": "StandardSSD_LRS" | |
| } | |
| }, | |
| "dataDisks": [ | |
| { | |
| "name": "[concat(variables('adVMName'), '_DataDisk')]", | |
| "caching": "ReadWrite", | |
| "createOption": "Empty", | |
| "diskSizeGB": 20, | |
| "managedDisk": { | |
| "storageAccountType": "StandardSSD_LRS" | |
| }, | |
| "lun": 0 | |
| } | |
| ] | |
| }, | |
| "networkProfile": { | |
| "networkInterfaces": [ | |
| { | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('adNicName'))]" | |
| } | |
| ] | |
| } | |
| }, | |
| "resources": [ | |
| { | |
| "type": "extensions", | |
| "apiVersion": "2019-03-01", | |
| "name": "CreateADForest", | |
| "location": "[parameters('location')]", | |
| "dependsOn": [ | |
| "[variables('adVMName')]" | |
| ], | |
| "properties": { | |
| "publisher": "Microsoft.Powershell", | |
| "type": "DSC", | |
| "typeHandlerVersion": "2.19", | |
| "autoUpgradeMinorVersion": true, | |
| "settings": { | |
| "ModulesUrl": "[uri(parameters('_artifactsLocation'), concat('DSC/CreateADPDC.zip', parameters('_artifactsLocationSasToken')))]", | |
| "ConfigurationFunction": "CreateADPDC.ps1\\CreateADPDC", | |
| "Properties": { | |
| "DomainName": "[parameters('domainName')]", | |
| "AdminCreds": { | |
| "UserName": "[parameters('adminUsername')]", | |
| "Password": "PrivateSettingsRef:AdminPassword" | |
| } | |
| } | |
| }, | |
| "protectedSettings": { | |
| "Items": { | |
| "AdminPassword": "[parameters('adminPassword')]" | |
| } | |
| } | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "Microsoft.Resources/deployments", | |
| "apiVersion": "2018-11-01", | |
| "name": "UpdateVNetDNS", | |
| "dependsOn": [ | |
| "CreateADForest" | |
| ], | |
| "properties": { | |
| "mode": "Incremental", | |
| "templateLink": { | |
| "uri": "[uri(parameters('_artifactsLocation'), concat('nestedtemplates/vnet-with-dns-server.json', parameters('_artifactsLocationSasToken')))]", | |
| "contentVersion": "1.0.0.0" | |
| }, | |
| "parameters": { | |
| "virtualNetworkName": { | |
| "value": "[variables('virtualNetworkName')]" | |
| }, | |
| "virtualNetworkAddressRange": { | |
| "value": "[variables('virtualNetworkAddressRange')]" | |
| }, | |
| "subnetName": { | |
| "value": "[variables('adSubnetName')]" | |
| }, | |
| "subnetRange": { | |
| "value": "[variables('adSubnetAddressPrefix')]" | |
| }, | |
| "DNSServerAddress": { | |
| "value": [ | |
| "[variables('adNicIPAddress')]" | |
| ] | |
| }, | |
| "location": { | |
| "value": "[parameters('location')]" | |
| } | |
| } | |
| } | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment