Skip to content

Instantly share code, notes, and snippets.

@BernieWhite
Created September 19, 2018 04:38
Show Gist options
  • Save BernieWhite/f02b282989e775901a5ea3c525645e32 to your computer and use it in GitHub Desktop.
Save BernieWhite/f02b282989e775901a5ea3c525645e32 to your computer and use it in GitHub Desktop.
mgmtset.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmLocation": {
"type": "string",
"defaultValue": "eastus2",
"allowedValues": [
"eastus2",
"westus2"
],
"metadata": {
"description": "The Azure region to deploy resources"
}
},
"vmNamePrefix": {
"type": "string"
},
"vmOSSku": {
"type": "string",
"defaultValue": "2016-Datacenter-Server-Core",
"metadata": {
"description": "The operating system image to use"
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A2_v2",
"allowedValues": [
"Standard_A2_v2",
"Standard_A1_v2",
"Standard_A4_v2"
]
},
"vmInstances": {
"type": "int",
"minValue": 1,
"maxValue": 2,
"defaultValue": 1,
"metadata": {
"description": "Number of VM instances to be created"
}
},
"adminUsername": {
"type": "string"
},
"adminPassword": {
"type": "securestring"
},
"vnetId": {
"type": "string"
},
"subnet": {
"type": "string"
},
"dscRegistrationKey": {
"type": "securestring",
"defaultValue": ""
},
"dscRegistrationUrl": {
"type": "string",
"defaultValue": ""
},
"dscRegistrationConfigurationSASToken": {
"type": "securestring",
"defaultValue": ""
},
"pipLabel": {
"type": "string",
"defaultValue": "be-core-mgmt"
},
"environment": {
"type": "string",
"defaultValue": "production",
"allowedValues": [
"production",
"internal"
]
},
"workspaceId": {
"type": "string",
"defaultValue": "/subscriptions/a7437ea4-0e87-4129-8862-0b47fabb4665/resourcegroups/be-oms/providers/microsoft.operationalinsights/workspaces/be-oms"
}
},
"variables": {
"asName": "[concat(parameters('vmNamePrefix'), '-as')]",
"subnetId": "[concat(parameters('vnetId'),'/subnets/', parameters('subnet'))]",
"loadBalancerName": "[concat(parameters('vmNamePrefix'), '-lb')]",
"pipName": "[concat(parameters('vmNamePrefix'), '-pip')]",
"ipAllocationMethod": "Dynamic",
"dscRegistrationConfigurationUrl": "https://bedeploystore.blob.core.windows.net/arm/RegistrationMetaConfigV2.zip"
},
"resources": [
{
"comments": "Management VM load balancer public IP",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('pipName')]",
"location": "[parameters('vmLocation')]",
"apiVersion": "2017-06-01",
"tags": {
"service": "infrastructure",
"role": "management",
"costCenter": "12345"
},
"properties": {
"publicIPAllocationMethod": "[variables('ipAllocationMethod')]",
"dnsSettings": {
"domainNameLabel": "[parameters('pipLabel')]"
}
}
},
{
"comments": "Management VM public load balancer",
"type": "Microsoft.Network/loadBalancers",
"name": "[variables('loadBalancerName')]",
"location": "[parameters('vmLocation')]",
"apiVersion": "2017-06-01",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipName'))]"
],
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "LoadBalancerFrontEnd",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIpAddresses', variables('pipName'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "backend-web-pool"
}
]
}
},
{
"comments": "RDP NAT rule for connectivity to Management VM",
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"name": "[concat(variables('loadBalancerName'), '/', 'nat-rdp-', copyIndex())]",
"location": "[parameters('vmLocation')]",
"copy": {
"name": "lbNatLoop",
"count": "[parameters('vmInstances')]"
},
"dependsOn": [
"[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]"
],
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {
"frontendIPConfiguration": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIPConfigurations/LoadBalancerFrontEnd')]"
},
"protocol": "tcp",
"frontendPort": "[copyIndex(50000)]",
"backendPort": 3389,
"enableFloatingIP": false
}
},
{
"comments": "Management VM",
"name": "[concat(parameters('vmNamePrefix'), '-', copyindex())]",
"copy": {
"name": "vmLoop",
"count": "[parameters('vmInstances')]"
},
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2016-04-30-preview",
"location": "[parameters('vmLocation')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', parameters('vmNamePrefix'), '-', copyindex(), '-nic0')]",
"[concat('Microsoft.Compute/availabilitySets/', variables('asName'))]",
"[concat('Microsoft.Compute/disks/', parameters('vmNamePrefix'), '-', copyindex(), '-data-disk-01')]"
],
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {
"osProfile": {
"computerName": "[concat(parameters('vmNamePrefix'), '-', copyindex())]",
"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('vmNamePrefix'), '-', copyindex(), '-os-disk')]",
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "Standard_LRS"
}
},
"dataDisks": [
{
"lun": 0,
"name": "[concat(parameters('vmNamePrefix'), '-', copyindex(),'-data-disk-01')]",
"createOption": "Attach",
"caching": "None",
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks/', concat(parameters('vmNamePrefix'), '-', copyindex(), '-data-disk-01'))]"
}
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('vmNamePrefix'), '-', copyindex(), '-nic0'))]"
}
]
},
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', variables('asName'))]"
}
}
},
{
"comments": "Management VM data disk",
"name": "[concat(parameters('vmNamePrefix'), '-', copyindex(), '-data-disk-01')]",
"copy": {
"name": "vmDataDiskLoop",
"count": "[parameters('vmInstances')]"
},
"type": "Microsoft.Compute/disks",
"apiVersion": "2017-03-30",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {
"osType": "Windows",
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 32
}
},
{
"comments": "Management VM availability set",
"name": "[variables('asName')]",
"type": "Microsoft.Compute/availabilitySets",
"apiVersion": "2016-04-30-preview",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {
"platformFaultDomainCount": 2,
"platformUpdateDomainCount": 5,
"managed": true
}
},
{
"comments": "Management VM network interface",
"name": "[concat(parameters('vmNamePrefix'), '-', copyindex(), '-nic0')]",
"copy": {
"name": "vmNICLoop",
"count": "[parameters('vmInstances')]"
},
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2016-09-01",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[variables('subnetId')]"
},
"privateIPAllocationMethod": "Dynamic",
"loadBalancerInboundNatRules": [
{
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/inboundNatRules/nat-rdp-', copyIndex())]"
}
]
}
}
]
},
"dependsOn": [
"[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/inboundNatRules/nat-rdp-', copyIndex())]"
]
},
{
"comments": "Management VM network Watcher extension",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('vmNamePrefix'), '-', copyindex(), '/Microsoft.Azure.NetworkWatcher')]",
"copy": {
"name": "vmDSCExtensionLoop",
"count": "[parameters('vmInstances')]"
},
"apiVersion": "2015-06-15",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {
"publisher": "Microsoft.Azure.NetworkWatcher",
"type": "NetworkWatcherAgentWindows",
"typeHandlerVersion": "1.4",
"autoUpgradeMinorVersion": true,
"settings": {}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', concat(parameters('vmNamePrefix'), '-', copyindex()))]"
]
},
{
"comments": "Management VM shutdown schedule",
"type": "Microsoft.DevTestLab/schedules",
"name": "[concat('shutdown-computevm-', parameters('vmNamePrefix'), '-', copyindex())]",
"copy": {
"name": "vmDSCExtensionLoop",
"count": "[parameters('vmInstances')]"
},
"apiVersion": "2016-05-15",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {
"status": "Enabled",
"taskType": "ComputeVmShutdownTask",
"dailyRecurrence": {
"time": "2100"
},
"timeZoneId": "E. Australia Standard Time",
"notificationSettings": {
"status": "Disabled",
"timeInMinutes": 30
},
"targetResourceId": "[resourceId('Microsoft.Compute/virtualMachines', concat(parameters('vmNamePrefix'), '-', copyindex()))]"
},
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', concat(parameters('vmNamePrefix'), '-', copyindex()))]"
]
},
{
"comments": "Management VM diagnostics extension",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('vmNamePrefix'), '-', copyindex(), '/IaaSDiagnostics')]",
"copy": {
"name": "vmDSCExtensionLoop",
"count": "[parameters('vmInstances')]"
},
"apiVersion": "2017-03-30",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {
"publisher": "Microsoft.Azure.Diagnostics",
"type": "IaaSDiagnostics",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": true,
"protectedSettings": {
"storageAccountName": "coremgmtdiag159",
"storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 'coremgmtdiag159'),'2015-06-15').key1]",
"storageAccountEndPoint": "https://core.windows.net"
},
"settings": {
"StorageAccount": "coremgmtdiag159",
"WadCfg": {
"DiagnosticMonitorConfiguration": {
"overallQuotaInMB": 5120,
"Metrics": {
"resourceId": "[resourceId('Microsoft.Compute/virtualMachines', concat(parameters('vmNamePrefix'), '-', copyindex()))]",
"MetricAggregation": [
{
"scheduledTransferPeriod": "PT1H"
},
{
"scheduledTransferPeriod": "PT1M"
}
]
},
"DiagnosticInfrastructureLogs": {
"scheduledTransferLogLevelFilter": "Error"
},
"PerformanceCounters": {
"scheduledTransferPeriod": "PT1M",
"PerformanceCounterConfiguration": [
{
"counterSpecifier": "\\Processor Information(_Total)\\% Processor Time",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Processor Information(_Total)\\% Privileged Time",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Processor Information(_Total)\\% User Time",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Processor Information(_Total)\\Processor Frequency",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\System\\Processes",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Process(_Total)\\Thread Count",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Process(_Total)\\Handle Count",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\System\\System Up Time",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\System\\Context Switches/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\System\\Processor Queue Length",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Memory\\% Committed Bytes In Use",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Memory\\Available Bytes",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Memory\\Committed Bytes",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Memory\\Cache Bytes",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Memory\\Pool Paged Bytes",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Memory\\Pool Nonpaged Bytes",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Memory\\Pages/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Memory\\Page Faults/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Process(_Total)\\Working Set",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Process(_Total)\\Working Set - Private",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Time",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Read Time",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Write Time",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\% Idle Time",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Disk Bytes/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Disk Read Bytes/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Disk Write Bytes/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Disk Transfers/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Disk Reads/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Disk Writes/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Transfer",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Read",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Write",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Queue Length",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Read Queue Length",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Write Queue Length",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\% Free Space",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\LogicalDisk(_Total)\\Free Megabytes",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Network Interface(*)\\Bytes Total/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Network Interface(*)\\Bytes Sent/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Network Interface(*)\\Bytes Received/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Network Interface(*)\\Packets/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Network Interface(*)\\Packets Sent/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Network Interface(*)\\Packets Received/sec",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Network Interface(*)\\Packets Outbound Errors",
"sampleRate": "PT1M"
},
{
"counterSpecifier": "\\Network Interface(*)\\Packets Received Errors",
"sampleRate": "PT1M"
}
]
},
"WindowsEventLog": {
"scheduledTransferPeriod": "PT1M",
"DataSource": [
{
"name": "Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]"
},
{
"name": "Security!*[System[band(Keywords,4503599627370496)]]"
},
{
"name": "System!*[System[(Level = 1 or Level = 2 or Level = 3)]]"
}
]
}
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', concat(parameters('vmNamePrefix'), '-', copyindex()))]"
]
},
{
"comments": "Management VM diagnostics storage account",
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"name": "coremgmtdiag159",
"apiVersion": "2017-10-01",
"location": "[parameters('vmLocation')]",
"tags": {
"service": "infrastructure",
"role": "management"
},
"properties": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment