333 строки
13 KiB
JSON
333 строки
13 KiB
JSON
{
|
|
"$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_DS2_v2",
|
|
"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": "2017-10-01",
|
|
"name": "[variables('publicIPAddressName')]",
|
|
"location": "[parameters('location')]",
|
|
"properties": {
|
|
"publicIPAllocationMethod": "Static",
|
|
"dnsSettings": {
|
|
"domainNameLabel": "[parameters('dnsPrefix')]"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/availabilitySets",
|
|
"apiVersion": "2017-12-01",
|
|
"location": "[parameters('location')]",
|
|
"name": "[variables('adAvailabilitySetName')]",
|
|
"sku": {
|
|
"name": "Aligned"
|
|
},
|
|
"properties": {
|
|
"PlatformUpdateDomainCount": 5,
|
|
"PlatformFaultDomainCount": 2
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Resources/deployments",
|
|
"apiVersion": "2018-09-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": "2017-10-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": "2017-10-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": "2017-12-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": "Standard_LRS"
|
|
}
|
|
},
|
|
"dataDisks": [
|
|
{
|
|
"name": "[concat(variables('adVMName'), '_DataDisk')]",
|
|
"caching": "ReadWrite",
|
|
"createOption": "Empty",
|
|
"diskSizeGB": 20,
|
|
"managedDisk": {
|
|
"storageAccountType": "Standard_LRS"
|
|
},
|
|
"lun": 0
|
|
}
|
|
]
|
|
},
|
|
"networkProfile": {
|
|
"networkInterfaces": [
|
|
{
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('adNicName'))]"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "extensions",
|
|
"apiVersion": "2017-12-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-09-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')]"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|