diff --git a/OnbordingTemplates/ConfigureWorkspace/ConfigureWorkspaceParameters.json b/OnbordingTemplates/ConfigureWorkspace/ConfigureWorkspaceParameters.json new file mode 100644 index 0000000..93088f5 --- /dev/null +++ b/OnbordingTemplates/ConfigureWorkspace/ConfigureWorkspaceParameters.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "WorkspaceResourceId": { + "value": "/subscriptions//resourceGroups//providers/Microsoft.OperationalInsights/workspaces/" + }, + "WorkspaceLocation": { + "value": "" + } + } +} \ No newline at end of file diff --git a/OnbordingTemplates/ConfigureWorkspace/ConfigureWorkspaceTemplate.json b/OnbordingTemplates/ConfigureWorkspace/ConfigureWorkspaceTemplate.json new file mode 100644 index 0000000..70a453c --- /dev/null +++ b/OnbordingTemplates/ConfigureWorkspace/ConfigureWorkspaceTemplate.json @@ -0,0 +1,418 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "WorkspaceResourceId": { + "type": "String", + "metadata": { + "description": "Workspace Resource ID." + } + }, + "WorkspaceLocation": { + "type": "String", + "metadata": { + "description": "Workspace Location." + } + } + }, + "variables": {}, + "resources": [ + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2017-05-10", + "name": "SMSolutionDeployment", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": {}, + "variables": {}, + "resources": [ + { + "apiVersion": "2015-11-01-preview", + "type": "Microsoft.OperationsManagement/solutions", + "location": "[parameters('WorkspaceLocation')]", + "name": "[concat('ServiceMap', '(', split(parameters('WorkspaceResourceId'),'/')[8], ')')]", + "properties": { + "workspaceResourceId": "[parameters('WorkspaceResourceId')]" + }, + "plan": { + "name": "[concat('ServiceMap', '(', split(parameters('WorkspaceResourceId'),'/')[8], ')')]", + "product": "[concat('OMSGallery/', 'ServiceMap')]", + "promotionCode": "", + "publisher": "Microsoft" + } + } + ] + } + }, + "subscriptionId": "[split(parameters('WorkspaceResourceId'),'/')[2]]", + "resourceGroup": "[split(parameters('WorkspaceResourceId'),'/')[4]]" + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2017-05-10", + "name": "PerfCountersDeployment", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": {}, + "variables": {}, + "resources": [ + { + "apiVersion": "2017-03-15-preview", + "type": "Microsoft.OperationalInsights/workspaces", + "name": "[split(parameters('WorkspaceResourceId'),'/')[8]]", + "location": "[parameters('WorkspaceLocation')]", + "resources": [ + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Pct-Free-Space", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "% Free Space" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Avg-DiskSecRead", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Avg. Disk sec/Read" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Avg-DiskSecTransfer", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Avg. Disk sec/Transfer" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Avg-DiskSecWrite", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Avg. Disk sec/Write" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Disk-BytesSec", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Disk Bytes/sec" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Disk-ReadBytesSec", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Disk Read Bytes/sec" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Disk-ReadsSec", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Disk Reads/sec" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Disk-TransfersSec", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Disk Transfers/sec" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Disk-WriteBytesSec", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Disk Write Bytes/sec" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-Disk-WritesSec", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Disk Writes/sec" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-LogicalDisk-FreeMegabytes", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "LogicalDisk", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Free Megabytes" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-Memory-AvailableMBytes", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "Memory", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Available MBytes" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-NetworkAdapter-BytesReceived-sec", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "Network Adapter", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Bytes Received/sec" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-NetworkAdapter-BytesSent-sec", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "Network Adapter", + "instanceName": "*", + "intervalSeconds": 60, + "counterName": "Bytes Sent/sec" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-Processor-Pct-Processor-Time-Total", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "WindowsPerformanceCounter", + "properties": { + "objectName": "Processor", + "instanceName": "_Total", + "intervalSeconds": 60, + "counterName": "% Processor Time" + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-Logical-Disk-Linux", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "LinuxPerformanceObject", + "properties": { + "objectName": "Logical Disk", + "instanceName": "*", + "intervalSeconds": 60, + "performanceCounters": [ + { + "counterName": "% Used Space" + }, + { + "counterName": "Disk Read Bytes/sec" + }, + { + "counterName": "Disk Reads/sec" + }, + { + "counterName": "Disk Transfers/sec" + }, + { + "counterName": "Disk Write Bytes/sec" + }, + { + "counterName": "Disk Writes/sec" + }, + { + "counterName": "Free Megabytes" + }, + { + "counterName": "Logical Disk Bytes/sec" + } + ] + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-Memory-Linux", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "LinuxPerformanceObject", + "properties": { + "objectName": "Memory", + "instanceName": "*", + "intervalSeconds": 60, + "performanceCounters": [ + { + "counterName": "Available MBytes Memory" + } + ] + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-Network", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "LinuxPerformanceObject", + "properties": { + "objectName": "Network", + "instanceName": "*", + "intervalSeconds": 60, + "performanceCounters": [ + { + "counterName": "Total Bytes Received" + }, + { + "counterName": "Total Bytes Transmitted" + } + ] + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "VMInsights-Processor-Pct-Processor-Time-Linux", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "LinuxPerformanceObject", + "properties": { + "objectName": "Processor", + "instanceName": "*", + "intervalSeconds": 60, + "performanceCounters": [ + { + "counterName": "% Processor Time" + } + ] + } + }, + { + "apiVersion": "2015-11-01-preview", + "type": "datasources", + "name": "DataSource_LinuxPerformanceCollection", + "dependsOn": [ + "[parameters('WorkspaceResourceId')]" + ], + "kind": "LinuxPerformanceCollection", + "properties": { + "state": "Enabled" + } + } + ] + } + ] + } + }, + "subscriptionId": "[split(parameters('WorkspaceResourceId'),'/')[2]]", + "resourceGroup": "[split(parameters('WorkspaceResourceId'),'/')[4]]" + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/OnbordingTemplates/ExistingVmOnboarding/ExistingVmOnboardingParameters.json b/OnbordingTemplates/ExistingVmOnboarding/ExistingVmOnboardingParameters.json new file mode 100644 index 0000000..6bddc97 --- /dev/null +++ b/OnbordingTemplates/ExistingVmOnboarding/ExistingVmOnboardingParameters.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "vmResourceId": { + "value": "/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachines/" + }, + "vmLocation": { + "value": "" + }, + "osType": { + "value": "" + }, + "workspaceResourceId": { + "value": "/subscriptions//resourceGroups//providers/Microsoft.OperationalInsights/workspaces/" + } + } +} \ No newline at end of file diff --git a/OnbordingTemplates/ExistingVmOnboarding/ExistingVmOnboardingTemplate.json b/OnbordingTemplates/ExistingVmOnboarding/ExistingVmOnboardingTemplate.json new file mode 100644 index 0000000..e93c801 --- /dev/null +++ b/OnbordingTemplates/ExistingVmOnboarding/ExistingVmOnboardingTemplate.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "VmResourceId": { + "type": "String", + "metadata": { + "description": "VM Resource ID." + } + }, + "VmLocation": { + "type": "String", + "metadata": { + "description": "The Virtual Machine Location." + } + }, + "osType": { + "type": "String", + "metadata": { + "description": "OS Type, Example: Linux / Windows" + } + }, + "WorkspaceResourceId": { + "type": "String", + "metadata": { + "description": "Workspace Resource ID." + } + } + }, + "variables": { + "VmName": "[split(parameters('VmResourceId'),'/')[8]]", + "DaExtensionName": "[if(equals(toLower(parameters('osType')), 'windows'), 'DependencyAgentWindows', 'DependencyAgentLinux')]", + "DaExtensionType": "[if(equals(toLower(parameters('osType')), 'windows'), 'DependencyAgentWindows', 'DependencyAgentLinux')]", + "DaExtensionVersion": "9.5", + "MmaExtensionName": "[if(equals(toLower(parameters('osType')), 'windows'), 'MMAExtension', 'OMSExtension')]", + "MmaExtensionType": "[if(equals(toLower(parameters('osType')), 'windows'), 'MicrosoftMonitoringAgent', 'OmsAgentForLinux')]", + "MmaExtensionVersion": "[if(equals(toLower(parameters('osType')), 'windows'), '1.0', '1.4')]" + }, + "resources": [ + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2018-10-01", + "name": "[variables('VmName')]", + "location": "[parameters('VmLocation')]", + "resources": [ + { + "type": "extensions", + "apiVersion": "2018-10-01", + "name": "[variables('DaExtensionName')]", + "location": "[parameters('VmLocation')]", + "dependsOn": [ + "[concat('Microsoft.Compute/VirtualMachines/', variables('VmName'))]" + ], + "properties": { + "publisher": "Microsoft.Azure.Monitoring.DependencyAgent", + "type": "[variables('DaExtensionType')]", + "typeHandlerVersion": "[variables('DaExtensionVersion')]", + "autoUpgradeMinorVersion": true + } + }, + { + "type": "extensions", + "apiVersion": "2018-10-01", + "name": "[variables('MmaExtensionName')]", + "location": "[parameters('VmLocation')]", + "dependsOn": [ + "[concat('Microsoft.Compute/VirtualMachines/', variables('VmName'))]" + ], + "properties": { + "publisher": "Microsoft.EnterpriseCloud.Monitoring", + "type": "[variables('MmaExtensionType')]", + "typeHandlerVersion": "[variables('MmaExtensionVersion')]", + "autoUpgradeMinorVersion": "true", + "settings": { + "workspaceId": "[reference(parameters('WorkspaceResourceId'), '2015-03-20').customerId]", + "azureResourceId": "[parameters('VmResourceId')]", + "stopOnMultipleConnections": "true" + }, + "protectedSettings": { + "workspaceKey": "[listKeys(parameters('WorkspaceResourceId'), '2015-03-20').primarySharedKey]" + } + } + } + ] + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/OnbordingTemplates/ExistingVmssOnboarding/ExistingVmssOnboardingParameters.json b/OnbordingTemplates/ExistingVmssOnboarding/ExistingVmssOnboardingParameters.json new file mode 100644 index 0000000..c2fe45c --- /dev/null +++ b/OnbordingTemplates/ExistingVmssOnboarding/ExistingVmssOnboardingParameters.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "VmssResourceId": { + "value": "/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachines/" + }, + "VmssLocation": { + "value": "" + }, + "OsType": { + "value": "" + }, + "WorkspaceResourceId": { + "value": "/subscriptions//resourceGroups//providers/Microsoft.OperationalInsights/workspaces/" + } + } +} \ No newline at end of file diff --git a/OnbordingTemplates/ExistingVmssOnboarding/ExistingVmssOnboardingTemplate.json b/OnbordingTemplates/ExistingVmssOnboarding/ExistingVmssOnboardingTemplate.json new file mode 100644 index 0000000..24cf618 --- /dev/null +++ b/OnbordingTemplates/ExistingVmssOnboarding/ExistingVmssOnboardingTemplate.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "VmssResourceId": { + "type": "String", + "metadata": { + "description": "VM Resource ID." + } + }, + "VmssLocation": { + "type": "String", + "metadata": { + "description": "The Virtual Machine Location." + } + }, + "osType": { + "type": "String", + "metadata": { + "description": "OS Type, Example: Linux / Windows" + } + }, + "WorkspaceResourceId": { + "type": "String", + "metadata": { + "description": "Workspace Resource ID." + } + } + }, + "variables": { + "VmssName": "[split(parameters('VmssResourceId'),'/')[8]]", + "DaExtensionName": "[if(equals(toLower(parameters('osType')), 'windows'), 'DependencyAgentWindows', 'DependencyAgentLinux')]", + "DaExtensionType": "[if(equals(toLower(parameters('osType')), 'windows'), 'DependencyAgentWindows', 'DependencyAgentLinux')]", + "DaExtensionVersion": "9.5", + "MmaExtensionName": "[if(equals(toLower(parameters('osType')), 'windows'), 'MMAExtension', 'OMSExtension')]", + "MmaExtensionType": "[if(equals(toLower(parameters('osType')), 'windows'), 'MicrosoftMonitoringAgent', 'OmsAgentForLinux')]", + "MmaExtensionVersion": "[if(equals(toLower(parameters('osType')), 'windows'), '1.0', '1.4')]" + }, + "resources": [ + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "apiVersion": "2018-10-01", + "name": "[variables('VmssName')]", + "location": "[parameters('VmssLocation')]", + "resources": [ + { + "type": "extensions", + "apiVersion": "2018-10-01", + "name": "[variables('DaExtensionName')]", + "location": "[parameters('VmssLocation')]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachineScaleSets/', variables('VmssName'))]" + ], + "properties": { + "publisher": "Microsoft.Azure.Monitoring.DependencyAgent", + "type": "[variables('DaExtensionType')]", + "typeHandlerVersion": "[variables('DaExtensionVersion')]", + "autoUpgradeMinorVersion": true + } + }, + { + "type": "extensions", + "apiVersion": "2018-10-01", + "name": "[variables('MmaExtensionName')]", + "location": "[parameters('VmssLocation')]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachineScaleSets/', variables('VmssName'))]" + ], + "properties": { + "publisher": "Microsoft.EnterpriseCloud.Monitoring", + "type": "[variables('MmaExtensionType')]", + "typeHandlerVersion": "[variables('MmaExtensionVersion')]", + "autoUpgradeMinorVersion": "true", + "settings": { + "workspaceId": "[reference(parameters('WorkspaceResourceId'), '2015-03-20').customerId]", + "azureResourceId": "[parameters('VmssResourceId')]", + "stopOnMultipleConnections": "true" + }, + "protectedSettings": { + "workspaceKey": "[listKeys(parameters('WorkspaceResourceId'), '2015-03-20').primarySharedKey]" + } + } + } + ] + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/OnbordingTemplates/NewVmOnboarding/NewVmOnboardingParameters.json b/OnbordingTemplates/NewVmOnboarding/NewVmOnboardingParameters.json new file mode 100644 index 0000000..3870b54 --- /dev/null +++ b/OnbordingTemplates/NewVmOnboarding/NewVmOnboardingParameters.json @@ -0,0 +1,50 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "value": "" + }, + "image": { + "value": { + "publisher": "", + "offer": "", + "sku": "", + "version": "" + } + }, + "osType": { + "value": "" + }, + "networkInterfaceName": { + "value": "" + }, + "subnetName": { + "value": "default" + }, + "virtualNetworkId": { + "value": "/subscriptions///VmBladeTest/providers/Microsoft.Network/virtualNetworks/" + }, + "workspaceId": { + "value": "/subscriptions//resourceGroups//providers/Microsoft.OperationalInsights/workspaces/" + }, + "virtualMachineName": { + "value": "" + }, + "virtualMachineRG": { + "value": "" + }, + "osDiskType": { + "value": "" + }, + "virtualMachineSize": { + "value": "" + }, + "adminUsername": { + "value": "" + }, + "adminPassword": { + "value": "" + } + } +} \ No newline at end of file diff --git a/OnbordingTemplates/NewVmOnboarding/NewVmOnboardingTemplate.json b/OnbordingTemplates/NewVmOnboarding/NewVmOnboardingTemplate.json new file mode 100644 index 0000000..a6aa2aa --- /dev/null +++ b/OnbordingTemplates/NewVmOnboarding/NewVmOnboardingTemplate.json @@ -0,0 +1,163 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "String" + }, + "image": { + "type": "Object" + }, + "networkInterfaceName": { + "type": "String" + }, + "subnetName": { + "type": "String" + }, + "virtualNetworkId": { + "type": "String" + }, + "workspaceResourceId": { + "type": "String", + "metadata": { + "description": "Workspace Resource ID." + } + }, + "osType": { + "type": "String", + "metadata": { + "description": "OS Type, Example: Linux / Windows" + } + }, + "virtualMachineName": { + "type": "String" + }, + "virtualMachineRG": { + "type": "String" + }, + "osDiskType": { + "type": "String" + }, + "virtualMachineSize": { + "type": "String" + }, + "adminUsername": { + "type": "String" + }, + "adminPassword": { + "type": "SecureString" + } + }, + "variables": { + "vnetId": "[parameters('virtualNetworkId')]", + "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]", + "daExtensionName": "[if(equals(toLower(parameters('osType')), 'windows'), 'DependencyAgentWindows', 'DependencyAgentLinux')]", + "daExtensionType": "[if(equals(toLower(parameters('osType')), 'windows'), 'DependencyAgentWindows', 'DependencyAgentLinux')]", + "daExtensionVersion": "9.5", + "mmaExtensionName": "[if(equals(toLower(parameters('osType')), 'windows'), 'MMAExtension', 'OMSExtension')]", + "mmaExtensionType": "[if(equals(toLower(parameters('osType')), 'windows'), 'MicrosoftMonitoringAgent', 'OmsAgentForLinux')]", + "mmaExtensionVersion": "[if(equals(toLower(parameters('osType')), 'windows'), '1.0', '1.4')]" + }, + "resources": [ + { + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2018-10-01", + "name": "[parameters('networkInterfaceName')]", + "location": "[parameters('location')]", + "dependsOn": [], + "tags": {}, + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "subnet": { + "id": "[variables('subnetRef')]" + }, + "privateIPAllocationMethod": "Dynamic" + } + } + ] + } + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2018-06-01", + "name": "[parameters('virtualMachineName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]" + ], + "tags": {}, + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('virtualMachineSize')]" + }, + "storageProfile": { + "osDisk": { + "createOption": "fromImage", + "managedDisk": { + "storageAccountType": "[parameters('osDiskType')]" + } + }, + "imageReference": "[parameters('image')]" + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]" + } + ] + }, + "osProfile": { + "computerName": "[parameters('virtualMachineName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + } + } + }, + { + "type": "Microsoft.Compute/virtualMachines/extensions", + "apiVersion": "2017-12-01", + "name": "[concat(parameters('virtualMachineName'),'/', variables('daExtensionName'))]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]" + ], + "properties": { + "publisher": "Microsoft.Azure.Monitoring.DependencyAgent", + "type": "[variables('daExtensionType')]", + "typeHandlerVersion": "[variables('daExtensionVersion')]", + "autoUpgradeMinorVersion": true + } + }, + { + "type": "Microsoft.Compute/virtualMachines/extensions", + "apiVersion": "2017-12-01", + "name": "[concat(parameters('virtualMachineName'),'/', variables('mmaExtensionName'))]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]" + ], + "properties": { + "publisher": "Microsoft.EnterpriseCloud.Monitoring", + "type": "[variables('mmaExtensionType')]", + "typeHandlerVersion": "[variables('mmaExtensionVersion')]", + "autoUpgradeMinorVersion": true, + "settings": { + "workspaceId": "[reference(parameters('workspaceResourceId'), '2015-03-20').customerId]", + "stopOnMultipleConnections": true + }, + "protectedSettings": { + "workspaceKey": "[listKeys(parameters('workspaceResourceId'), '2015-03-20').primarySharedKey]" + } + } + } + ], + "outputs": { + "adminUsername": { + "type": "String", + "value": "[parameters('adminUsername')]" + } + } +} \ No newline at end of file diff --git a/OnbordingTemplates/NewVmssOnboarding/NewVmssOnboardingParameters.json b/OnbordingTemplates/NewVmssOnboarding/NewVmssOnboardingParameters.json new file mode 100644 index 0000000..553ddfa --- /dev/null +++ b/OnbordingTemplates/NewVmssOnboarding/NewVmssOnboardingParameters.json @@ -0,0 +1,71 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "value": "" + }, + "vmssName": { + "value": "" + }, + "vmSku": { + "value": "" + }, + "adminUsername": { + "value": "" + }, + "instanceCount": { + "value": "" + }, + "image": { + "value": { + "sku": "", + "publisher": "", + "version": "", + "offer": "" + } + }, + "singlePlacementGroup": { + "value": "true" + }, + "pipName": { + "value": "" + }, + "pipLabel": { + "value": "" + }, + "skuType": { + "value": "Standard" + }, + "ipAllocationMethod": { + "value": "Static" + }, + "priority": { + "value": "Regular" + }, + "subnetId": { + "value": "" + }, + "enableAcceleratedNetworking": { + "value": "false" + }, + "publicIpAddressPerInstance": { + "value": "false" + }, + "upgradeMode": { + "value": "" + }, + "adminPassword": { + "value": "" + }, + "vnetName": { + "value": "" + }, + "subnetResourceGroup": { + "value": "" + }, + "workspaceId": { + "value": "/subscriptions//resourceGroups//providers/Microsoft.OperationalInsights/workspaces/" + } + } +} \ No newline at end of file diff --git a/OnbordingTemplates/NewVmssOnboarding/NewVmssOnboardingTemplate.json b/OnbordingTemplates/NewVmssOnboarding/NewVmssOnboardingTemplate.json new file mode 100644 index 0000000..ee5323e --- /dev/null +++ b/OnbordingTemplates/NewVmssOnboarding/NewVmssOnboardingTemplate.json @@ -0,0 +1,203 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "String" + }, + "vmssName": { + "type": "String" + }, + "vmSku": { + "type": "String" + }, + "adminUsername": { + "type": "String" + }, + "instanceCount": { + "type": "String" + }, + "image": { + "type": "Object" + }, + "osType": { + "type": "String" + }, + "singlePlacementGroup": { + "type": "String" + }, + "pipName": { + "type": "String" + }, + "pipLabel": { + "type": "String" + }, + "skuType": { + "type": "String" + }, + "ipAllocationMethod": { + "type": "String" + }, + "priority": { + "type": "String" + }, + "subnetId": { + "type": "String" + }, + "enableAcceleratedNetworking": { + "type": "String" + }, + "publicIpAddressPerInstance": { + "type": "String" + }, + "upgradeMode": { + "type": "String" + }, + "adminPassword": { + "type": "SecureString" + }, + "vnetName": { + "type": "String" + }, + "subnetResourceGroup": { + "type": "String" + }, + "workspaceResourceId": { + "type": "String" + } + }, + "variables": { + "namingInfix": "[toLower(substring(concat(parameters('vmssName'), uniqueString(resourceGroup().id)), 0, 9))]", + "networkApiVersion": "2018-01-01", + "storageApiVersion": "2018-07-01", + "computeApiVersion": "2018-06-01", + "autoscaleApiVersion": "2015-04-01", + "vhdContainerName": "[concat(variables('namingInfix'), 'vhd')]", + "storageAccountNamePrefix": "[toLower(concat(substring(uniqueString(resourceGroup().id), 0, 9), variables('namingInfix'), 'sa'))]", + "daExtensionName": "[if(equals(toLower(parameters('osType')), 'windows'), 'DependencyAgentWindows', 'DependencyAgentLinux')]", + "daExtensionType": "[if(equals(toLower(parameters('osType')), 'windows'), 'DependencyAgentWindows', 'DependencyAgentLinux')]", + "daExtensionVersion": "9.5", + "mmaExtensionName": "[if(equals(toLower(parameters('osType')), 'windows'), 'MMAExtension', 'OMSExtension')]", + "mmaExtensionType": "[if(equals(toLower(parameters('osType')), 'windows'), 'MicrosoftMonitoringAgent', 'OmsAgentForLinux')]", + "mmaExtensionVersion": "[if(equals(toLower(parameters('osType')), 'windows'), '1.0', '1.4')]" + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "sku": { + "name": "Premium_LRS" + }, + "kind": "Storage", + "name": "[concat(variables('storageAccountNamePrefix'), copyIndex())]", + "apiVersion": "[variables('storageApiVersion')]", + "location": "[parameters('location')]", + "copy": { + "name": "storageLoop", + "count": 5 + }, + "properties": {} + }, + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "sku": { + "name": "[parameters('vmSku')]", + "tier": "Standard", + "capacity": "[int(parameters('instanceCount'))]" + }, + "name": "[parameters('vmssName')]", + "apiVersion": "[variables('computeApiVersion')]", + "location": "[parameters('location')]", + "properties": { + "overprovision": "true", + "upgradePolicy": { + "mode": "[parameters('upgradeMode')]" + }, + "singlePlacementGroup": "[parameters('singlePlacementGroup')]", + "virtualMachineProfile": { + "storageProfile": { + "imageReference": "[parameters('image')]", + "osDisk": { + "createOption": "FromImage", + "caching": "ReadWrite", + "name": "[concat(variables('namingInfix'), 'osdisk')]", + "vhdContainers": [ + "[concat(reference(concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '0')), variables('storageApiVersion')).primaryEndpoints.blob, variables('vhdContainerName'))]", + "[concat(reference(concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '1')), variables('storageApiVersion')).primaryEndpoints.blob, variables('vhdContainerName'))]", + "[concat(reference(concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '2')), variables('storageApiVersion')).primaryEndpoints.blob, variables('vhdContainerName'))]", + "[concat(reference(concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '3')), variables('storageApiVersion')).primaryEndpoints.blob, variables('vhdContainerName'))]", + "[concat(reference(concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '4')), variables('storageApiVersion')).primaryEndpoints.blob, variables('vhdContainerName'))]" + ] + } + }, + "priority": "[parameters('priority')]", + "osProfile": { + "computerNamePrefix": "[variables('namingInfix')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "[concat(parameters('vmssName'), 'Nic')]", + "properties": { + "primary": "true", + "enableAcceleratedNetworking": "[parameters('enableAcceleratedNetworking')]", + "ipConfigurations": [ + { + "name": "[concat(parameters('vmssName'), 'IpConfig')]", + "properties": { + "subnet": { + "id": "[parameters('subnetId')]" + } + } + } + ] + } + } + ] + }, + "extensionProfile": { + "extensions": [ + { + "type": "extensions", + "name": "[variables('mmaExtensionName')]", + "location": "[parameters('location')]", + "properties": { + "publisher": "Microsoft.EnterpriseCloud.Monitoring", + "type": "[variables('mmaExtensionType')]", + "typeHandlerVersion": "[variables('mmaExtensionVersion')]", + "autoUpgradeMinorVersion": true, + "settings": { + "workspaceId": "[reference(parameters('workspaceResourceId'), '2015-03-20').customerId]", + "stopOnMultipleConnections": "true" + }, + "protectedSettings": { + "workspaceKey": "[listKeys(parameters('workspaceResourceId'), '2015-03-20').primarySharedKey]" + } + } + }, + { + "type": "extensions", + "name": "[variables('daExtensionName')]", + "location": "[parameters('location')]", + "properties": { + "publisher": "Microsoft.Azure.Monitoring.DependencyAgent", + "type": "[variables('daExtensionType')]", + "typeHandlerVersion": "[variables('daExtensionVersion')]", + "autoUpgradeMinorVersion": true + } + } + ] + } + } + }, + "dependsOn": [ + "[concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '0'))]", + "[concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '1'))]", + "[concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '2'))]", + "[concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '3'))]", + "[concat('Microsoft.Storage/storageAccounts/', concat(variables('storageAccountNamePrefix'), '4'))]" + ] + } + ] +} \ No newline at end of file diff --git a/ReadMe.md b/ReadMe.md new file mode 100644 index 0000000..f0ff3dc --- /dev/null +++ b/ReadMe.md @@ -0,0 +1,46 @@ +# ARM Templates to deploy Azure Monitor for VMs + +This download contains onboarding templates for different scenarios: + +### Virtual Machines: +- ExistingVmOnboarding: Use this template to enable Azure Monitor for VMs if the Virtual Machines already exists. +- NewVmOnboarding: Use this template to create a Virtual Machine and onboard it to Azure Monitor for VMs. + +### Virtual Machine Scale Sets: +- ExistingVmssOnboarding: Use this template to enable Azure Monitor for VMs if the Virtual Scale Sets already exists. +- NewVmssOnboarding: Use this template to create a Virtual Machine Scale Sets and onboard it to Azure Monitor for VMs. + +> Note: If Virtual Machines Scale Sets are already present and the upgrade policy is set to 'Manual', Azure Monitor for VMs will not be enabled for instances by default after running 'ExistingVmssOnboarding' template. You have Manually upgrade the instances. + +### Configure Workspace: +- ConfigureWorkspace: Use this to enable Azure Monitor for VMs features for a new workspace and to configure the performance counters. + +## How to Deploy: +Each folder has a 'Template' and a 'Parameters' file. +Modify the 'Parameters' file with appropriate details, such as Virtual Machine Resource Id, Workspace resource Id, Location, OS Type etc. Do not modify the 'Template' file unless you need to customize it for you particular scenario. + +Once details are entered in the 'Parameters' file you can deploy them in multiple ways: + +#### 1. Using the portal UI: +You can login to Azure Portal and [deploy this Azure Resource Manager template](https://docs.microsoft.com/azure/azure-resource-manager/resource-manager-quickstart-create-templates-use-the-portal) along with modified parameters. + +#### 2. Powershell: +If using Powershell, please run the following command: + +```sh +New-AzResourceGroupDeployment -Name OnboardCluster -ResourceGroupName -TemplateFile -TemplateParameterFile +``` + +#### 3. Azure CLI: +If using Azure CLI, please run the following command: + +```sh +az login +az account set --subscription "Subscription Name" +az group deployment create --resource-group --template-file --parameters +``` + +### Links: +[Azure Monitor for VMs (preview)](https://docs.microsoft.com/azure/azure-monitor/insights/vminsights-overview) + +[Deploy Azure Monitor for VMs (preview)](https://docs.microsoft.com/azure/azure-monitor/insights/vminsights-onboard)