Skip to content

Instantly share code, notes, and snippets.

@BernieWhite
Created January 18, 2018 06:36
Show Gist options
  • Save BernieWhite/e8c220585ca5c0d5d4caccb009627d2c to your computer and use it in GitHub Desktop.
Save BernieWhite/e8c220585ca5c0d5d4caccb009627d2c to your computer and use it in GitHub Desktop.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmLocation": {
"type": "string"
},
"vmName": {
"type": "string"
},
"vmOSSku": {
"type": "string",
"defaultValue": "2016-Datacenter-Server-Core"
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A2_v2"
},
"adminUsername": {
"type": "string"
},
"adminPassword": {
"type": "securestring"
},
"vnetId": {
"type": "string"
},
"subnet": {
"type": "string"
},
"dscRegistrationKey": {
"type": "securestring",
"defaultValue": ""
},
"dscRegistrationUrl": {
"type": "string",
"defaultValue": ""
},
"project": {
"type": "string",
"defaultValue": "Activate Azure for IaaS"
}
},
"variables": {
"nicName": "[concat(parameters('vmName'), '-nic0')]",
"asName": "[concat(parameters('vmName'), '-as')]",
"subnetId": "[concat(parameters('vnetId'),'/subnets/', parameters('subnet'))]"
},
"resources": [
{
"comments": "Domain controller VM",
"name": "[parameters('vmName')]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2016-04-30-preview",
"location": "[parameters('vmLocation')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]",
"[concat('Microsoft.Compute/availabilitySets/', variables('asName'))]",
"[concat('Microsoft.Compute/disks/', parameters('vmName'),'-data-disk-01')]"
],
"tags": {
"service": "infrastructure",
"role": "domain-controller",
"project": "[parameters('project')]"
},
"properties": {
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"windowsConfiguration": {
"provisionVmAgent": "true"
}
},
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "[parameters('vmOSSku')]",
"version": "latest"
},
"osDisk": {
"name": "[concat(parameters('vmName'), '-os-disk')]",
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "Standard_LRS"
}
},
"dataDisks": [
{
"lun": 0,
"name": "[concat(parameters('vmName'),'-data-disk-01')]",
"createOption": "Attach",
"caching": "None",
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks/', concat(parameters('vmName'),'-data-disk-01'))]"
}
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
}
]
},
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', variables('asName'))]"
}
}
},
{
"name": "[concat(parameters('vmName'),'-data-disk-01')]",
"type": "Microsoft.Compute/disks",
"apiVersion": "2017-03-30",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"project": "[parameters('project')]"
},
"properties": {
"osType": "Windows",
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 32
}
},
{
"comments": "Domain controller availability set",
"name": "[variables('asName')]",
"type": "Microsoft.Compute/availabilitySets",
"apiVersion": "2016-04-30-preview",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"project": "[parameters('project')]"
},
"properties": {
"platformFaultDomainCount": 2,
"platformUpdateDomainCount": 5,
"managed": true
}
},
{
"name": "[variables('nicName')]",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2016-09-01",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"project": "[parameters('project')]"
},
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[variables('subnetId')]"
},
"privateIPAllocationMethod": "Dynamic"
}
}
]
}
},
{
"comments": "DSC extension",
"condition": "[not(or(equals(parameters('dscRegistrationKey'),''),equals(parameters('dscRegistrationUrl'),'')))]",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('vmName'), '/Microsoft.Powershell.DSC')]",
"apiVersion": "2017-03-30",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"project": "[parameters('project')]"
},
"scale": null,
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.70",
"autoUpgradeMinorVersion": true,
"settings": {
"ModulesUrl": "https://eus2oaasibizamarketprod1.blob.core.windows.net/automationdscpreview/RegistrationMetaConfigV2.zip",
"ConfigurationFunction": "RegistrationMetaConfigV2.ps1\\RegistrationMetaConfigV2",
"Properties": [
{
"Name": "RegistrationKey",
"Value": {
"UserName": "PLACEHOLDER_DONOTUSE",
"Password": "PrivateSettingsRef:registrationKey"
},
"TypeName": "System.Management.Automation.PSCredential"
},
{
"Name": "RegistrationUrl",
"Value": "[parameters('dscRegistrationUrl')]",
"TypeName": "System.String"
},
{
"Name": "NodeConfigurationName",
"Value": "",
"TypeName": "System.String"
},
{
"Name": "ConfigurationMode",
"Value": "applyAndAutoCorrect",
"TypeName": "System.String"
},
{
"Name": "ConfigurationModeFrequencyMins",
"Value": 15,
"TypeName": "System.Int32"
},
{
"Name": "RefreshFrequencyMins",
"Value": 30,
"TypeName": "System.Int32"
},
{
"Name": "RebootNodeIfNeeded",
"Value": true,
"TypeName": "System.Boolean"
},
{
"Name": "ActionAfterReboot",
"Value": "continueConfiguration",
"TypeName": "System.String"
},
{
"Name": "AllowModuleOverwrite",
"Value": true,
"TypeName": "System.Boolean"
}
]
},
"protectedSettings": {
"Items": {
"registrationKey": "[parameters('dscRegistrationKey')]"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment