├── Host ├── Guides │ ├── Lectures - Day 1 │ │ ├── Monitoring Overview.pptx │ │ └── Security and Management Area Overview.pptx │ ├── Lectures - Day 2 │ │ └── Log Analytics Overview.pptx │ ├── Lectures - Day 3 │ │ └── App Insights Overview.pptx │ ├── Lectures - Extras │ │ ├── Governance Overview.pptx │ │ └── Security Center Overview.pptx │ └── Proctors Guide.docx └── Solutions │ ├── Completed Hack │ ├── AlertsTemplate │ │ ├── GenerateAlertRules.json │ │ ├── deployAlertRules.parameters.json │ │ └── deployAlertRulesTemplate.ps1 │ ├── DeployMonHackEnv.ps1 │ ├── VMSSazuredeploy.json │ └── azuredeploy.parameters.json │ └── old │ ├── Dockerfile │ ├── SetupDBServers.ps1 │ └── VMazuredeploy.json ├── README.md ├── Student ├── Guides │ ├── Challenges.pptx │ ├── Deployment Setup Guide.docx │ └── HammerDB Setup Guide.docx └── Resources │ ├── AlertsTemplate │ ├── GenerateAlertRules.json │ ├── deployAlertRules.parameters.json │ ├── deployAlertRulesTemplate.ps1 │ └── deployAlertRulesTemplate.sh │ ├── DeployMonHackEnv.ps1 │ ├── DeployMonHackEnv.sh │ ├── Loadscripts │ ├── UrlGenLoadwithCurl.sh │ ├── UrlGenLoadwithPS.ps1 │ └── cpuGenLoadwithPS.ps1 │ ├── Log Analytics │ ├── MonitoringHackSampleLAQueries.csl │ └── eShop Server Health.omsview │ ├── SetupVSServer.ps1 │ ├── SetupWebServers.ps1 │ ├── VMSSazuredeploy.json │ └── azuredeploy.parameters.json └── monitoringhackdiagram.png /Host/Guides/Lectures - Day 1/Monitoring Overview.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Host/Guides/Lectures - Day 1/Monitoring Overview.pptx -------------------------------------------------------------------------------- /Host/Guides/Lectures - Day 1/Security and Management Area Overview.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Host/Guides/Lectures - Day 1/Security and Management Area Overview.pptx -------------------------------------------------------------------------------- /Host/Guides/Lectures - Day 2/Log Analytics Overview.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Host/Guides/Lectures - Day 2/Log Analytics Overview.pptx -------------------------------------------------------------------------------- /Host/Guides/Lectures - Day 3/App Insights Overview.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Host/Guides/Lectures - Day 3/App Insights Overview.pptx -------------------------------------------------------------------------------- /Host/Guides/Lectures - Extras/Governance Overview.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Host/Guides/Lectures - Extras/Governance Overview.pptx -------------------------------------------------------------------------------- /Host/Guides/Lectures - Extras/Security Center Overview.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Host/Guides/Lectures - Extras/Security Center Overview.pptx -------------------------------------------------------------------------------- /Host/Guides/Proctors Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Host/Guides/Proctors Guide.docx -------------------------------------------------------------------------------- /Host/Solutions/Completed Hack/AlertsTemplate/GenerateAlertRules.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "alertVMs": { 6 | "type": "array", 7 | "metadata": { 8 | "description": "" 9 | } 10 | }, 11 | "alertSeverity": { 12 | "type": "int", 13 | "defaultValue": 2, 14 | "allowedValues": [ 15 | 0, 16 | 1, 17 | 2, 18 | 3, 19 | 4 20 | ], 21 | "metadata": { 22 | "description": "Sev 0 = Critical, Sev 1 = Error, Sev 2 = Warning, Sev 3 = Informational, Sev 4 = Verbose" 23 | } 24 | }, 25 | "isEnabled": { 26 | "type": "bool", 27 | "defaultValue": true 28 | }, 29 | "actionGroupId": { 30 | "type": "string", 31 | "metadata": { 32 | "description": "" 33 | } 34 | } 35 | }, 36 | "variables": {}, 37 | "resources": [ 38 | { 39 | "type": "Microsoft.Insights/metricAlerts", 40 | "name": "[concat('Network_In_Alert','-',parameters('alertVMs')[copyIndex()])]", 41 | "copy": { 42 | "name": "iterator", 43 | "count": "[length(parameters('alertVMs'))]" 44 | }, 45 | "apiVersion": "2018-03-01", 46 | "location": "global", 47 | "tags": {}, 48 | "scale": null, 49 | "properties": { 50 | "description": "Network In metric has detected a large amount of inbound traffic", 51 | "severity": "[parameters('alertSeverity')]", 52 | "enabled": "[parameters('isEnabled')]", 53 | "scopes": [ 54 | "[resourceId('Microsoft.Compute/virtualMachines', parameters('alertVMs')[copyIndex()])]" 55 | ], 56 | "evaluationFrequency": "PT5M", 57 | "windowSize": "PT5M", 58 | "criteria": { 59 | "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", 60 | "allOf": [ 61 | { 62 | "name": "MetricNetIn", 63 | "metricName": "Network In", 64 | "dimensions": [], 65 | "operator": "GreaterThan", 66 | "threshold": 4000000, 67 | "timeAggregation": "Average" 68 | } 69 | ] 70 | }, 71 | "actions": [ 72 | { 73 | "actionGroupId": "[parameters('actionGroupId')]", 74 | "webHookProperties": {} 75 | } 76 | ] 77 | }, 78 | "dependsOn": [] 79 | }, 80 | { 81 | "type": "Microsoft.Insights/metricAlerts", 82 | "name": "[concat('Disk_Write_Alert','-',parameters('alertVMs')[copyIndex()])]", 83 | "copy": { 84 | "name": "iterator", 85 | "count": "[length(parameters('alertVMs'))]" 86 | }, 87 | "apiVersion": "2018-03-01", 88 | "location": "global", 89 | "tags": {}, 90 | "scale": null, 91 | "properties": { 92 | "description": "Disk Write metric has detected a large amount of disk operations", 93 | "severity": "[parameters('alertSeverity')]", 94 | "enabled": "[parameters('isEnabled')]", 95 | "scopes": [ 96 | "[resourceId('Microsoft.Compute/virtualMachines', parameters('alertVMs')[copyIndex()])]" 97 | ], 98 | "evaluationFrequency": "PT5M", 99 | "windowSize": "PT5M", 100 | "criteria": { 101 | "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", 102 | "allOf": [ 103 | { 104 | "name": "MetricDiskWriteOper", 105 | "metricName": "Disk Write Operations/Sec", 106 | "dimensions": [], 107 | "operator": "GreaterThan", 108 | "threshold": 10, 109 | "timeAggregation": "Average" 110 | } 111 | ] 112 | }, 113 | "actions": [ 114 | { 115 | "actionGroupId": "[parameters('actionGroupId')]", 116 | "webHookProperties": {} 117 | } 118 | ] 119 | }, 120 | "dependsOn": [] 121 | }, 122 | { 123 | "type": "Microsoft.Insights/metricAlerts", 124 | "name": "[concat('CPU_Alert','-',parameters('alertVMs')[copyIndex()])]", 125 | "copy": { 126 | "name": "iterator", 127 | "count": "[length(parameters('alertVMs'))]" 128 | }, 129 | "apiVersion": "2018-03-01", 130 | "location": "global", 131 | "properties": { 132 | "description": "Alert for CPU Usage over 75 percent", 133 | "severity": "[parameters('alertSeverity')]", 134 | "enabled": "[parameters('isEnabled')]", 135 | "scopes": [ 136 | "[resourceId('Microsoft.Compute/virtualMachines', parameters('alertVMs')[copyIndex()])]" 137 | ], 138 | "evaluationFrequency": "PT1M", 139 | "windowSize": "PT5M", 140 | "templateType": 8, 141 | "templateSpecificParameters": {}, 142 | "criteria": { 143 | "allOf": [ 144 | { 145 | "name": "MetricCPU", 146 | "metricNamespace": "Microsoft.Compute/virtualMachines", 147 | "metricName": "Percentage CPU", 148 | "dimensions": [], 149 | "operator": "GreaterThan", 150 | "threshold": 75, 151 | "monitorTemplateType": 8, 152 | "timeAggregation": "Average", 153 | "criterionType": "StaticThresholdCriterion" 154 | } 155 | ], 156 | "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" 157 | }, 158 | "autoMitigate": true, 159 | "actions": [ 160 | { 161 | "actionGroupId": "[parameters('actionGroupId')]" 162 | } 163 | ] 164 | } 165 | } 166 | ], 167 | "outputs": {} 168 | } -------------------------------------------------------------------------------- /Host/Solutions/Completed Hack/AlertsTemplate/deployAlertRules.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "actionGroupId": { 6 | "value": "/subscriptions/8b2ef784-0c0d-424c-8a7a-aa1304a0366a/resourceGroups/mon19/providers/microsoft.insights/actiongroups/Hack19AG" 7 | }, 8 | "alertVMs": { 9 | "value": [ 10 | "mon19sqlSrv16", 11 | "mon19VSSrv17" 12 | ] 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Host/Solutions/Completed Hack/AlertsTemplate/deployAlertRulesTemplate.ps1: -------------------------------------------------------------------------------- 1 | Connect-AzureRmAccount 2 | 3 | #Specify your resourcegroup 4 | $rgname="mon19" 5 | $rg = Get-AzureRmResourceGroup -Name $rgname 6 | 7 | #Get Azure Monitor Action Group 8 | (Get-AzureRmResource -ResourceType 'Microsoft.Insights/actiongroups').ResourceId 9 | 10 | #Update Path to files as needed 11 | #Update the parameters file with the names of your VMs and the ResourceId of your Action Group (use command above to find ResourceId) 12 | $template=".\AlertsTemplate\GenerateAlertRules.json" 13 | $para=".\AlertsTemplate\deployAlertRules.parameters.json" 14 | 15 | $job = 'job.' + ((Get-Date).ToUniversalTime()).tostring("MMddyy.HHmm") 16 | New-AzureRmResourceGroupDeployment ` 17 | -Name $job ` 18 | -ResourceGroupName $rg.ResourceGroupName ` 19 | -TemplateFile $template ` 20 | -TemplateParameterFile $para 21 | 22 | 23 | #Note: At the time I created this, the PowerShell cmdlet was targeting the wrong resourceType and is scheduled to be updated 24 | #To check your results - Get metrixAlerts Rule for Resourcegroup 25 | Get-AzureRmResource -ResourceGroupName $rg.ResourceGroupName -ResourceType 'Microsoft.Insights/metricalerts' -Name CPU*| ft 26 | 27 | #To delete your Alert Rules 28 | Get-AzureRmResource -ResourceGroupName $rg.ResourceGroupName -ResourceType 'Microsoft.Insights/metricalerts' -Name CPU* | Remove-AzureRmResource -Force -------------------------------------------------------------------------------- /Host/Solutions/Completed Hack/DeployMonHackEnv.ps1: -------------------------------------------------------------------------------- 1 | #PowerShell Commands to create an Azure Key Vault and deployment for Monitoring Hackathon 2 | #Make sure to install the VS Code extension for PowerShell 3 | #Tip: Show the Integrated Terminal from View\Integrated Terminal 4 | #Tip: click on a line and press "F8" to run the line of code 5 | 6 | #Make sure you are running the latest version of the Azure PowerShell modules, uncomment the line below and run it (F8) 7 | # Install-Module -Name AzureRM -Force -Scope CurrentUser -AllowClobber 8 | 9 | #Step 1: Use a name no longer then five charactors all lowercase. Your initials would work well if working in the same sub as others. 10 | $MonitoringHackName = 'mon19' 11 | 12 | #Step 2: Create ResourceGroup after updating the location to one of your choice. Use get-AzureRmLocation to see a list 13 | Connect-AzureRmAccount 14 | New-AzureRMResourceGroup -Name $MonitoringHackName -Location 'East US' #The hack uses a few features in preview so its best to leave this in East US 15 | $rg = get-AzureRmresourcegroup -Name $MonitoringHackName 16 | 17 | #Step 3: Create Key Vault and set flag to enable for template deployment with ARM 18 | $MonitoringHackVaultName = $MonitoringHackName + 'MonitoringHackVault' 19 | New-AzureRmKeyVault -VaultName $MonitoringHackVaultName -ResourceGroupName $rg.ResourceGroupName -Location $rg.Location -EnabledForTemplateDeployment 20 | 21 | #Step 4: Add password as a secret. Note:this will prompt you for a user and password. User should be vmadmin and a password that meet the azure pwd police like P@ssw0rd123!! 22 | Set-AzureKeyVaultSecret -VaultName $MonitoringHackVaultName -Name "VMPassword" -SecretValue (Get-Credential).Password 23 | 24 | #Step 5: Update azuredeploy.parameters.json file with your envPrefixName and Key Vault info example- /subscriptions/{guid}/resourceGroups/{group-name}/providers/Microsoft.KeyVault/vaults/{vault-name} 25 | (Get-AzureRmKeyVault -VaultName $MonitoringHackVaultName).ResourceId 26 | 27 | #Step 6: Run deployment below after updating and SAVING the parameter file with your key vault info. Make sure to update the paths to the json files or run the command from the same directory 28 | #Note: You may want to adjust the VM series deployed in the ARM template. Feel free to modify the ARM template to use a different VM Series. 29 | New-AzureRmResourceGroupDeployment -Name $MonitoringHackName -ResourceGroupName $MonitoringHackName -TemplateFile '.\VMSSazuredeploy.json' -TemplateParameterFile '.\azuredeploy.parameters.json' -------------------------------------------------------------------------------- /Host/Solutions/Completed Hack/azuredeploy.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "envPrefixName": { 6 | "value": "mon19" 7 | }, 8 | "username": { 9 | "value": "vmadmin" 10 | }, 11 | "password": { 12 | "reference": { 13 | "keyVault": { 14 | "id": "/subscriptions/8b2ef784-0c0d-424c-8a7a-aa1304a0366a/resourceGroups/mon19/providers/Microsoft.KeyVault/vaults/mon19MonitoringHackVault" 15 | }, 16 | "secretName": "VMPassword" 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Host/Solutions/old/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:latest 2 | 3 | RUN rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm 4 | RUN yum update -y 5 | RUN yum install libunwind libicu dotnet-sdk-2.1 samba-client samba-common cifs-utils -y 6 | 7 | RUN mkdir /mnt/eshoponweb 8 | 9 | #RUN mount.cifs //mon12VSSrv17/eShopPub /mnt/eshoponweb -o user=vmadmin,password='DaisyCotton123!',vers=2.0 10 | #ENTRYPOINT ["dotnet /mnt/eshoponweb/Web.dll"] 11 | 12 | CMD ["/bin/bash"] 13 | -------------------------------------------------------------------------------- /Host/Solutions/old/SetupDBServers.ps1: -------------------------------------------------------------------------------- 1 | #Create inbound Windows Firewall rule for SQL Server on TCP port 1433 2 | New-NetFirewallRule -DisplayName "Allow SQL Connections on 1433" -Direction Inbound -LocalPort 1433 -Protocol TCP -Action Allow 3 | 4 | #Switch SQL Authentication to mixed mode 5 | Set-SqlAuthenticationMode -Credential $Credential -Mode Mixed -SqlCredential $sqlCredential -ForceServiceRestart -AcceptSelfSignedCertificate 6 | 7 | #Create SQL Server user called sqladmin and grant SA rights 8 | 9 | -------------------------------------------------------------------------------- /Host/Solutions/old/VMazuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "envPrefixName": { 6 | "type": "string", 7 | "metadata": { 8 | "description": "Prefix for the environment (2-5 characters)" 9 | }, 10 | "defaultValue": "hack1", 11 | "minLength": 2, 12 | "maxLength": 5 13 | }, 14 | "username": { 15 | "type": "string", 16 | "metadata": { 17 | "description": "VM local administrator username" 18 | } 19 | }, 20 | "password": { 21 | "type": "securestring", 22 | "metadata": { 23 | "description": "VM local administrator password" 24 | } 25 | }, 26 | "webSrvVMSize": { 27 | "type": "string", 28 | "allowedValues": [ 29 | "Standard_B2ms", 30 | "Standard_B4ms" 31 | ], 32 | "metadata": { 33 | "description": "The size of the Web Server VMs Created" 34 | }, 35 | "defaultValue": "Standard_B2ms" 36 | }, 37 | "numberOfWebSrvs": { 38 | "type": "int", 39 | "metadata": { 40 | "description": "Number of Web Servers" 41 | }, 42 | "allowedValues": [ 43 | 1, 44 | 2 45 | ], 46 | "defaultValue": 2 47 | }, 48 | "sqlVMSize": { 49 | "type": "string", 50 | "allowedValues": [ 51 | "Standard_B2ms", 52 | "Standard_B4ms" 53 | ], 54 | "metadata": { 55 | "description": "The size of the SQL VM Created" 56 | }, 57 | "defaultValue": "Standard_B2ms" 58 | }, 59 | "VisualStudioVMSize": { 60 | "type": "string", 61 | "allowedValues": [ 62 | "Standard_B2ms", 63 | "Standard_B4ms" 64 | ], 65 | "metadata": { 66 | "description": "The size of the Visual Studio VM Created" 67 | }, 68 | "defaultValue": "Standard_B2ms" 69 | }, 70 | "diskType": { 71 | "type": "string", 72 | "allowedValues": [ 73 | "Standard_LRS", 74 | "Premium_LRS" 75 | ], 76 | "metadata": { 77 | "description": "The type of the Storage Account created" 78 | }, 79 | "defaultValue": "Premium_LRS" 80 | }, 81 | "sqlConnectivityType": { 82 | "type": "string", 83 | "metadata": { 84 | "description": "Server only, Private or Public" 85 | }, 86 | 87 | "defaultValue": "Private" 88 | }, 89 | "sqlPortNumber": { 90 | "type": "int", 91 | "metadata": { 92 | "description": "sql server Port Number" 93 | }, 94 | 95 | "defaultValue": 1433 96 | }, 97 | "sqlAuthenticationLogin": { 98 | "type": "string", 99 | "metadata": { 100 | "description": "sql server admin username" 101 | }, 102 | 103 | "defaultValue": "sqladmin" 104 | }, 105 | "rServicesEnabled": { 106 | "type": "string", 107 | "defaultValue": "false" 108 | }, 109 | "storageAccountType": { 110 | "type": "string", 111 | "defaultValue": "Standard_LRS", 112 | "allowedValues": [ 113 | "Standard_LRS", 114 | "Standard_GRS", 115 | "Standard_ZRS", 116 | "Premium_LRS" 117 | ], 118 | "metadata": { 119 | "description": "Storage Account type" 120 | } 121 | }, 122 | "location": { 123 | "type": "string", 124 | "defaultValue": "[resourceGroup().location]", 125 | "metadata": { 126 | "description": "Location for all resources." 127 | } 128 | } 129 | }, 130 | "variables": { 131 | "virtualNetworkName": "[concat(parameters('envPrefixName'), 'Vnet')]", 132 | "resourceId": "[resourceGroup().id]", 133 | "addressPrefix": "10.0.0.0/16", 134 | "feSubnetPrefix": "10.0.0.0/24", 135 | "dbSubnetPrefix": "10.0.2.0/24", 136 | "feNSGName": "feNsg", 137 | "dbNSGName": "dbNsg", 138 | "sqlSrvDBName": "[concat(parameters('envPrefixName'), 'sqlSrv16')]", 139 | "sqlVmSize": "[parameters('sqlVMSize')]", 140 | "sqlSrvDBNicName": "[concat(variables('sqlSrvDBName'), 'Nic')]", 141 | "sqlSvrDBSubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), 'DBSubnetName')]", 142 | "sqlPublicIP": "[concat(parameters('envPrefixName'), 'SqlPip')]", 143 | "sqlPublicIPRef": "[resourceId('Microsoft.Network/publicIPAddresses', variables('sqlPublicIP'))]", 144 | "sqlImagePublisher": "MicrosoftSQLServer", 145 | "sqlImageOffer": "SQL2016SP1-WS2016", 146 | "sqlImageSku": "Standard", 147 | "VisualStudioSrvName": "[concat(parameters('envPrefixName'), 'VSSrv17')]", 148 | "VisualStudioVmSize": "[parameters('VisualStudioVMSize')]", 149 | "VisualStudioNicName": "[concat(variables('VisualStudioSrvName'), 'Nic')]", 150 | "VisualStudioSubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), 'FESubnetName')]", 151 | "VisualStudioPublicIP": "[concat(parameters('envPrefixName'), 'VSPip')]", 152 | "VisualStudioPublicIPRef": "[resourceId('Microsoft.Network/publicIPAddresses', variables('VisualStudioPublicIP'))]", 153 | "VisualStudioImagePublisher": "MicrosoftVisualStudio", 154 | "VisualStudioImageOffer": "VisualStudio", 155 | "VisualStudioImageSku": "VS-2017-Comm-Latest-Preview-WS2016", 156 | "webSrvName": "[concat(parameters('envPrefixName'), 'webSrv')]", 157 | "webSrvVMSize": "[parameters('webSrvVMSize')]", 158 | "webSrvNicName": "[concat(variables('webSrvName'), 'Nic')]", 159 | "webSrvSubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), 'FESubnetName')]", 160 | "webSrvPublicIP": "[concat(parameters('envPrefixName'), 'websrvpip')]", 161 | "webSrvAvailabilitySetName": "[concat(parameters('envPrefixName'), 'webSrvAS')]", 162 | "webSrvNumbOfInstances": "[parameters('numberOfWebSrvs')]", 163 | "webSrvDnsNameforLBIP": "[concat(toLower(variables('webSrvName')), 'lb')]", 164 | "webLbName": "[concat(variables('webSrvName'), 'lb')]", 165 | "webLblb_PIP_Id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('webSrvPublicIP'))]", 166 | "webLbId": "[resourceId('Microsoft.Network/loadBalancers',variables('webLbName'))]", 167 | "frontEndIPConfigID": "[concat(variables('webLbId'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]", 168 | "lbPoolID": "[concat(variables('webLbId'),'/backendAddressPools/BackendPool1')]", 169 | "lbProbeID": "[concat(variables('webLbId'),'/probes/tcpProbe')]", 170 | "storageAccountid": "[concat(variables('resourceId'),'/providers/Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", 171 | "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'mondiagact')]" 172 | }, 173 | "resources": [ 174 | { 175 | "type": "Microsoft.Storage/storageAccounts", 176 | "name": "[variables('storageAccountName')]", 177 | "apiVersion": "2016-01-01", 178 | "location": "[parameters('location')]", 179 | "sku": { 180 | "name": "[parameters('storageAccountType')]" 181 | }, 182 | "kind": "Storage", 183 | "properties": {} 184 | }, 185 | { 186 | "apiVersion": "2015-06-15", 187 | "type": "Microsoft.Network/networkSecurityGroups", 188 | "name": "[variables('feNSGName')]", 189 | "location": "[parameters('location')]", 190 | "tags": { 191 | "displayName": "FrontEndNSG" 192 | }, 193 | "properties": { 194 | "securityRules": [ 195 | { 196 | "name": "rdp_rule", 197 | "properties": { 198 | "description": "Allow RDP", 199 | "protocol": "Tcp", 200 | "sourcePortRange": "*", 201 | "destinationPortRange": "3389", 202 | "sourceAddressPrefix": "Internet", 203 | "destinationAddressPrefix": "*", 204 | "access": "Allow", 205 | "priority": 100, 206 | "direction": "Inbound" 207 | } 208 | }, 209 | { 210 | "name": "web_rule", 211 | "properties": { 212 | "description": "Allow WEB", 213 | "protocol": "Tcp", 214 | "sourcePortRange": "*", 215 | "destinationPortRange": "80", 216 | "sourceAddressPrefix": "Internet", 217 | "destinationAddressPrefix": "*", 218 | "access": "Allow", 219 | "priority": 101, 220 | "direction": "Inbound" 221 | } 222 | }, 223 | { 224 | "name": "publish_rule", 225 | "properties": { 226 | "description": "Allow Web Publish", 227 | "protocol": "Tcp", 228 | "sourcePortRange": "*", 229 | "destinationPortRange": "8172", 230 | "sourceAddressPrefix": "Internet", 231 | "destinationAddressPrefix": "*", 232 | "access": "Allow", 233 | "priority": 102, 234 | "direction": "Inbound" 235 | } 236 | } 237 | ] 238 | } 239 | }, 240 | { 241 | "type": "Microsoft.Network/networkSecurityGroups", 242 | "apiVersion": "2015-06-15", 243 | "name": "[variables('dbNSGName')]", 244 | "location": "[parameters('location')]", 245 | "tags": { 246 | "displayName": "BackEndNSG" 247 | }, 248 | "properties": { 249 | "securityRules": [ 250 | { 251 | "name": "Allow_FE", 252 | "properties": { 253 | "description": "Allow FE Subnet", 254 | "protocol": "Tcp", 255 | "sourcePortRange": "*", 256 | "destinationPortRange": "1433", 257 | "sourceAddressPrefix": "10.0.0.0/24", 258 | "destinationAddressPrefix": "*", 259 | "access": "Allow", 260 | "priority": 100, 261 | "direction": "Inbound" 262 | } 263 | }, 264 | { 265 | "name": "rdp_rule", 266 | "properties": { 267 | "description": "Allow RDP", 268 | "protocol": "Tcp", 269 | "sourcePortRange": "*", 270 | "destinationPortRange": "3389", 271 | "sourceAddressPrefix": "Internet", 272 | "destinationAddressPrefix": "*", 273 | "access": "Allow", 274 | "priority": 110, 275 | "direction": "Inbound" 276 | } 277 | }, 278 | { 279 | "name": "Block_FE", 280 | "properties": { 281 | "description": "Block App Subnet", 282 | "protocol": "*", 283 | "sourcePortRange": "*", 284 | "destinationPortRange": "*", 285 | "sourceAddressPrefix": "10.0.0.0/24", 286 | "destinationAddressPrefix": "*", 287 | "access": "Deny", 288 | "priority": 121, 289 | "direction": "Inbound" 290 | } 291 | }, 292 | { 293 | "name": "Block_Internet", 294 | "properties": { 295 | "description": "Block Internet", 296 | "protocol": "*", 297 | "sourcePortRange": "*", 298 | "destinationPortRange": "*", 299 | "sourceAddressPrefix": "*", 300 | "destinationAddressPrefix": "Internet", 301 | "access": "Deny", 302 | "priority": 200, 303 | "direction": "Outbound" 304 | } 305 | } 306 | ] 307 | } 308 | }, 309 | { 310 | "apiVersion": "2015-06-15", 311 | "type": "Microsoft.Network/virtualNetworks", 312 | "name": "[variables('virtualNetworkName')]", 313 | "location": "[parameters('location')]", 314 | "dependsOn": [ 315 | "[concat('Microsoft.Network/networkSecurityGroups/', variables('feNSGName'))]", 316 | "[concat('Microsoft.Network/networkSecurityGroups/', variables('dbNSGName'))]" 317 | ], 318 | "tags": { 319 | "displayName": "VirtualNetwork" 320 | }, 321 | "properties": { 322 | "addressSpace": { 323 | "addressPrefixes": [ 324 | "[variables('addressPrefix')]" 325 | ] 326 | }, 327 | "subnets": [ 328 | { 329 | "name": "FESubnetName", 330 | "properties": { 331 | "addressPrefix": "[variables('feSubnetPrefix')]", 332 | "networkSecurityGroup": { 333 | "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('feNSGName'))]" 334 | } 335 | } 336 | }, 337 | { 338 | "name": "DBSubnetName", 339 | "properties": { 340 | "addressPrefix": "[variables('dbSubnetPrefix')]", 341 | "networkSecurityGroup": { 342 | "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('dbNSGName'))]" 343 | } 344 | } 345 | } 346 | ] 347 | } 348 | }, 349 | { 350 | "name": "[variables('sqlPublicIP')]", 351 | "type": "Microsoft.Network/publicIPAddresses", 352 | "location": "[parameters('location')]", 353 | "apiVersion": "2015-06-15", 354 | "tags": { 355 | "displayName": "SqlPIP" 356 | }, 357 | "properties": { 358 | "publicIPAllocationMethod": "Dynamic", 359 | "idleTimeoutInMinutes": 4 360 | } 361 | }, 362 | { 363 | "name": "[variables('sqlSrvDBNicName')]", 364 | "type": "Microsoft.Network/networkInterfaces", 365 | "location": "[parameters('location')]", 366 | "apiVersion": "2015-06-15", 367 | "dependsOn": [ 368 | "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" 369 | ], 370 | "tags": { 371 | "displayName": "SQLSrvDBNic" 372 | }, 373 | "properties": { 374 | "ipConfigurations": [ 375 | { 376 | "name": "ipconfig1", 377 | "properties": { 378 | "privateIPAllocationMethod": "Dynamic", 379 | "subnet": { 380 | "id": "[variables('sqlSvrDBSubnetRef')]" 381 | }, 382 | "publicIPAddress": { 383 | "id": "[variables('sqlPublicIPRef')]" 384 | } 385 | } 386 | } 387 | ] 388 | } 389 | }, 390 | { 391 | "name": "[concat(parameters('envPrefixName'), 'sqlSrv16')]", 392 | "type": "Microsoft.Compute/virtualMachines", 393 | "location": "[parameters('location')]", 394 | "apiVersion": "2017-03-30", 395 | "dependsOn": [ 396 | "[concat('Microsoft.Network/networkInterfaces/', variables('sqlSrvDBNicName'))]", 397 | "[concat('Microsoft.Network/publicIPAddresses/', variables('sqlPublicIP'))]" 398 | ], 399 | "tags": { 400 | "displayName": "SQL-Svr-DB" 401 | }, 402 | "properties": { 403 | "hardwareProfile": { 404 | "vmSize": "[variables('sqlVmSize')]" 405 | }, 406 | "osProfile": { 407 | "computerName": "[variables('sqlSrvDBName')]", 408 | "adminUsername": "[parameters('username')]", 409 | "adminPassword": "[parameters('password')]" 410 | }, 411 | "storageProfile": { 412 | "imageReference": { 413 | "publisher": "[variables('sqlImagePublisher')]", 414 | "offer": "[variables('sqlImageOffer')]", 415 | "sku": "[variables('sqlImageSku')]", 416 | "version": "latest" 417 | }, 418 | "osDisk": { 419 | "name": "[concat(variables('sqlSrvDBName'),'_OSDisk')]", 420 | "caching": "ReadWrite", 421 | "createOption": "FromImage", 422 | "managedDisk": { 423 | "storageAccountType": "[parameters('diskType')]" 424 | } 425 | } 426 | }, 427 | "networkProfile": { 428 | "networkInterfaces": [ 429 | { 430 | "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('sqlSrvDBNicName'))]" 431 | } 432 | ] 433 | } 434 | } 435 | }, 436 | { 437 | "apiVersion": "2015-06-15", 438 | "type": "Microsoft.Compute/virtualMachines/extensions", 439 | "name": "[concat(parameters('envPrefixName'), 'sqlSrv16/SqlIaasExtension')]", 440 | "location": "[parameters('location')]", 441 | "dependsOn": [ 442 | "[concat('Microsoft.Compute/virtualMachines/', parameters('envPrefixName'), 'sqlSrv16')]" 443 | ], 444 | "properties": { 445 | "type": "SqlIaaSAgent", 446 | "publisher": "Microsoft.SqlServer.Management", 447 | "typeHandlerVersion": "1.2", 448 | "autoUpgradeMinorVersion": "true", 449 | "settings": { 450 | "AutoTelemetrySettings": { 451 | "Region": "[parameters('location')]" 452 | }, 453 | "AutoPatchingSettings": { 454 | "PatchCategory": "WindowsMandatoryUpdates", 455 | "Enable": false 456 | }, 457 | "KeyVaultCredentialSettings": { 458 | "Enable": false, 459 | "CredentialName": "" 460 | }, 461 | "ServerConfigurationsManagementSettings": { 462 | "SQLConnectivityUpdateSettings": { 463 | "ConnectivityType": "[parameters('sqlConnectivityType')]", 464 | "Port": "[parameters('sqlPortNumber')]" 465 | }, 466 | "AdditionalFeaturesServerConfigurations": { 467 | "IsRServicesEnabled": "[parameters('rServicesEnabled')]" 468 | } 469 | } 470 | }, 471 | "protectedSettings": { 472 | "SQLAuthUpdateUserName": "[parameters('sqlAuthenticationLogin')]", 473 | "SQLAuthUpdatePassword": "[parameters('password')]" 474 | } 475 | } 476 | }, 477 | { 478 | "name": "[variables('VisualStudioPublicIP')]", 479 | "type": "Microsoft.Network/publicIPAddresses", 480 | "location": "[parameters('location')]", 481 | "apiVersion": "2015-06-15", 482 | "tags": { 483 | "displayName": "VSPIP" 484 | }, 485 | "properties": { 486 | "publicIPAllocationMethod": "Dynamic", 487 | "idleTimeoutInMinutes": 4 488 | } 489 | }, 490 | { 491 | "name": "[variables('VisualStudioNicName')]", 492 | "type": "Microsoft.Network/networkInterfaces", 493 | "location": "[parameters('location')]", 494 | "apiVersion": "2015-06-15", 495 | "dependsOn": [ 496 | "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" 497 | ], 498 | "tags": { 499 | "displayName": "VSNic" 500 | }, 501 | "properties": { 502 | "ipConfigurations": [ 503 | { 504 | "name": "ipconfig1", 505 | "properties": { 506 | "privateIPAllocationMethod": "Dynamic", 507 | "subnet": { 508 | "id": "[variables('VisualStudioSubnetRef')]" 509 | }, 510 | "publicIPAddress": { 511 | "id": "[variables('VisualStudioPublicIPRef')]" 512 | } 513 | } 514 | } 515 | ] 516 | } 517 | }, 518 | { 519 | "name": "[concat(parameters('envPrefixName'), 'VSSrv17')]", 520 | "type": "Microsoft.Compute/virtualMachines", 521 | "location": "[parameters('location')]", 522 | "apiVersion": "2017-03-30", 523 | "dependsOn": [ 524 | "[concat('Microsoft.Network/networkInterfaces/', variables('VisualStudioNicName'))]", 525 | "[concat('Microsoft.Network/publicIPAddresses/', variables('VisualStudioPublicIP'))]", 526 | "[concat('Microsoft.Compute/virtualMachines/', parameters('envPrefixName'), 'sqlSrv16')]", 527 | "[concat('Microsoft.Compute/virtualMachines/' ,variables('webSrvName'), parameters('numberOfWebSrvs'))]" 528 | ], 529 | "tags": { 530 | "displayName": "VSSrv" 531 | }, 532 | "properties": { 533 | "hardwareProfile": { 534 | "vmSize": "[variables('VisualStudioVmSize')]" 535 | }, 536 | "osProfile": { 537 | "computerName": "[variables('VisualStudioSrvName')]", 538 | "adminUsername": "[parameters('username')]", 539 | "adminPassword": "[parameters('password')]" 540 | }, 541 | "storageProfile": { 542 | "imageReference": { 543 | "publisher": "[variables('VisualStudioImagePublisher')]", 544 | "offer": "[variables('VisualStudioImageOffer')]", 545 | "sku": "[variables('VisualStudioImageSku')]", 546 | "version": "latest" 547 | }, 548 | "osDisk": { 549 | "name": "[concat(variables('VisualStudioSrvName'),'_OSDisk')]", 550 | "caching": "ReadWrite", 551 | "createOption": "FromImage", 552 | "managedDisk": { 553 | "storageAccountType": "[parameters('diskType')]" 554 | } 555 | } 556 | }, 557 | "networkProfile": { 558 | "networkInterfaces": [ 559 | { 560 | "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('VisualStudioNicName'))]" 561 | } 562 | ] 563 | } 564 | }, 565 | "resources": [ 566 | { 567 | "type": "extensions", 568 | "name": "CustomScriptExtension", 569 | "apiVersion": "2017-03-30", 570 | "location": "[resourceGroup().location]", 571 | "dependsOn": [ 572 | "[concat('Microsoft.Compute/virtualMachines/' ,variables('VisualStudioSrvName'))]" 573 | ], 574 | "properties": { 575 | "publisher": "Microsoft.Compute", 576 | "type": "CustomScriptExtension", 577 | "typeHandlerVersion": "1.8", 578 | "autoUpgradeMinorVersion": true, 579 | "settings": { 580 | "fileUris": [ 581 | "https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/master/SetupVSServer.ps1" 582 | ], 583 | "commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File SetupVSServer.ps1 ', ' ', variables('sqlSrvDBName'), ' ', parameters('password'))]" 584 | } 585 | } 586 | }, 587 | { 588 | "name": "[concat(variables('VisualStudioSrvName'),'/', 'IaaSDiagnostics')]", 589 | "type": "Microsoft.Compute/virtualMachines/extensions", 590 | "apiVersion": "2017-12-01", 591 | "location": "[parameters('location')]", 592 | "dependsOn": [ 593 | "[concat('Microsoft.Compute/virtualMachines/' ,variables('VisualStudioSrvName'))]" 594 | ], 595 | "properties": { 596 | "publisher": "Microsoft.Azure.Diagnostics", 597 | "type": "IaaSDiagnostics", 598 | "typeHandlerVersion": "1.5", 599 | "autoUpgradeMinorVersion": true, 600 | "settings": { 601 | "StorageAccount": "[variables('storageAccountName')]", 602 | "WadCfg": { 603 | "DiagnosticMonitorConfiguration": { 604 | "overallQuotaInMB": 5120, 605 | "Metrics": { 606 | "resourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/', 'Microsoft.Compute/virtualMachines/', variables('VisualStudioSrvName'))]", 607 | "MetricAggregation": [ 608 | { 609 | "scheduledTransferPeriod": "PT1H" 610 | }, 611 | { 612 | "scheduledTransferPeriod": "PT1M" 613 | } 614 | ] 615 | }, 616 | "DiagnosticInfrastructureLogs": { 617 | "scheduledTransferLogLevelFilter": "Error" 618 | }, 619 | "PerformanceCounters": { 620 | "scheduledTransferPeriod": "PT1M", 621 | "PerformanceCounterConfiguration": [ 622 | { 623 | "counterSpecifier": "\\Processor Information(_Total)\\% Processor Time", 624 | "sampleRate": "PT1M" 625 | }, 626 | { 627 | "counterSpecifier": "\\Processor Information(_Total)\\% Privileged Time", 628 | "sampleRate": "PT1M" 629 | }, 630 | { 631 | "counterSpecifier": "\\Processor Information(_Total)\\% User Time", 632 | "sampleRate": "PT1M" 633 | }, 634 | { 635 | "counterSpecifier": "\\Processor Information(_Total)\\Processor Frequency", 636 | "sampleRate": "PT1M" 637 | }, 638 | { 639 | "counterSpecifier": "\\System\\Processes", 640 | "sampleRate": "PT1M" 641 | }, 642 | { 643 | "counterSpecifier": "\\Process(_Total)\\Thread Count", 644 | "sampleRate": "PT1M" 645 | }, 646 | { 647 | "counterSpecifier": "\\Process(_Total)\\Handle Count", 648 | "sampleRate": "PT1M" 649 | }, 650 | { 651 | "counterSpecifier": "\\System\\System Up Time", 652 | "sampleRate": "PT1M" 653 | }, 654 | { 655 | "counterSpecifier": "\\System\\Context Switches/sec", 656 | "sampleRate": "PT1M" 657 | }, 658 | { 659 | "counterSpecifier": "\\System\\Processor Queue Length", 660 | "sampleRate": "PT1M" 661 | }, 662 | { 663 | "counterSpecifier": "\\Memory\\% Committed Bytes In Use", 664 | "sampleRate": "PT1M" 665 | }, 666 | { 667 | "counterSpecifier": "\\Memory\\Available Bytes", 668 | "sampleRate": "PT1M" 669 | }, 670 | { 671 | "counterSpecifier": "\\Memory\\Committed Bytes", 672 | "sampleRate": "PT1M" 673 | }, 674 | { 675 | "counterSpecifier": "\\Memory\\Cache Bytes", 676 | "sampleRate": "PT1M" 677 | }, 678 | { 679 | "counterSpecifier": "\\Memory\\Pool Paged Bytes", 680 | "sampleRate": "PT1M" 681 | }, 682 | { 683 | "counterSpecifier": "\\Memory\\Pool Nonpaged Bytes", 684 | "sampleRate": "PT1M" 685 | }, 686 | { 687 | "counterSpecifier": "\\Memory\\Pages/sec", 688 | "sampleRate": "PT1M" 689 | }, 690 | { 691 | "counterSpecifier": "\\Memory\\Page Faults/sec", 692 | "sampleRate": "PT1M" 693 | }, 694 | { 695 | "counterSpecifier": "\\Process(_Total)\\Working Set", 696 | "sampleRate": "PT1M" 697 | }, 698 | { 699 | "counterSpecifier": "\\Process(_Total)\\Working Set - Private", 700 | "sampleRate": "PT1M" 701 | }, 702 | { 703 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Time", 704 | "sampleRate": "PT1M" 705 | }, 706 | { 707 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Read Time", 708 | "sampleRate": "PT1M" 709 | }, 710 | { 711 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Write Time", 712 | "sampleRate": "PT1M" 713 | }, 714 | { 715 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Idle Time", 716 | "sampleRate": "PT1M" 717 | }, 718 | { 719 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Bytes/sec", 720 | "sampleRate": "PT1M" 721 | }, 722 | { 723 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Read Bytes/sec", 724 | "sampleRate": "PT1M" 725 | }, 726 | { 727 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Write Bytes/sec", 728 | "sampleRate": "PT1M" 729 | }, 730 | { 731 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Transfers/sec", 732 | "sampleRate": "PT1M" 733 | }, 734 | { 735 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Reads/sec", 736 | "sampleRate": "PT1M" 737 | }, 738 | { 739 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Writes/sec", 740 | "sampleRate": "PT1M" 741 | }, 742 | { 743 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Transfer", 744 | "sampleRate": "PT1M" 745 | }, 746 | { 747 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Read", 748 | "sampleRate": "PT1M" 749 | }, 750 | { 751 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Write", 752 | "sampleRate": "PT1M" 753 | }, 754 | { 755 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Queue Length", 756 | "sampleRate": "PT1M" 757 | }, 758 | { 759 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Read Queue Length", 760 | "sampleRate": "PT1M" 761 | }, 762 | { 763 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Write Queue Length", 764 | "sampleRate": "PT1M" 765 | }, 766 | { 767 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Free Space", 768 | "sampleRate": "PT1M" 769 | }, 770 | { 771 | "counterSpecifier": "\\LogicalDisk(_Total)\\Free Megabytes", 772 | "sampleRate": "PT1M" 773 | }, 774 | { 775 | "counterSpecifier": "\\Network Interface(*)\\Bytes Total/sec", 776 | "sampleRate": "PT1M" 777 | }, 778 | { 779 | "counterSpecifier": "\\Network Interface(*)\\Bytes Sent/sec", 780 | "sampleRate": "PT1M" 781 | }, 782 | { 783 | "counterSpecifier": "\\Network Interface(*)\\Bytes Received/sec", 784 | "sampleRate": "PT1M" 785 | }, 786 | { 787 | "counterSpecifier": "\\Network Interface(*)\\Packets/sec", 788 | "sampleRate": "PT1M" 789 | }, 790 | { 791 | "counterSpecifier": "\\Network Interface(*)\\Packets Sent/sec", 792 | "sampleRate": "PT1M" 793 | }, 794 | { 795 | "counterSpecifier": "\\Network Interface(*)\\Packets Received/sec", 796 | "sampleRate": "PT1M" 797 | }, 798 | { 799 | "counterSpecifier": "\\Network Interface(*)\\Packets Outbound Errors", 800 | "sampleRate": "PT1M" 801 | }, 802 | { 803 | "counterSpecifier": "\\Network Interface(*)\\Packets Received Errors", 804 | "sampleRate": "PT1M" 805 | } 806 | ] 807 | }, 808 | "WindowsEventLog": { 809 | "scheduledTransferPeriod": "PT1M", 810 | "DataSource": [ 811 | { 812 | "name": "Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]" 813 | }, 814 | { 815 | "name": "Security!*[System[band(Keywords,4503599627370496)]]" 816 | }, 817 | { 818 | "name": "System!*[System[(Level = 1 or Level = 2 or Level = 3)]]" 819 | } 820 | ] 821 | } 822 | } 823 | } 824 | }, 825 | "protectedSettings": { 826 | "storageAccountName": "[variables('storageAccountName')]", 827 | "storageAccountKey": "[listKeys(variables('storageAccountId'),'2015-06-15').key1]", 828 | "storageAccountEndPoint": "https://core.windows.net/" 829 | } 830 | } 831 | } 832 | ] 833 | }, 834 | { 835 | "apiVersion": "2017-03-30", 836 | "type": "Microsoft.Compute/availabilitySets", 837 | "location": "[parameters('location')]", 838 | "name": "[variables('webSrvAvailabilitySetName')]", 839 | "properties": { 840 | "PlatformUpdateDomainCount": 20, 841 | "PlatformFaultDomainCount": 2 842 | }, 843 | "tags": { 844 | "displayName": "WebSrvAvailabilitySet" 845 | }, 846 | "sku": { 847 | "name": "Aligned" 848 | } 849 | }, 850 | { 851 | "name": "[variables('webSrvPublicIP')]", 852 | "type": "Microsoft.Network/publicIPAddresses", 853 | "location": "[parameters('location')]", 854 | "apiVersion": "2015-06-15", 855 | "tags": { 856 | "displayName": "WebSrvPIP for LB" 857 | }, 858 | "properties": { 859 | "publicIPAllocationMethod": "Dynamic", 860 | "idleTimeoutInMinutes": 4, 861 | "dnsSettings": { 862 | "domainNameLabel": "[variables('webSrvDnsNameforLBIP')]" 863 | } 864 | } 865 | }, 866 | { 867 | "apiVersion": "2015-06-15", 868 | "name": "[variables('webLbName')]", 869 | "type": "Microsoft.Network/loadBalancers", 870 | "location": "[parameters('location')]", 871 | "tags": { 872 | "displayName": "Web LB" 873 | }, 874 | "dependsOn": [ 875 | "[concat('Microsoft.Network/publicIPAddresses/', variables('webSrvPublicIP'))]" 876 | ], 877 | "properties": { 878 | "frontendIPConfigurations": [ 879 | { 880 | "name": "LoadBalancerFrontEnd", 881 | "properties": { 882 | "publicIPAddress": { 883 | "id": "[variables('webLblb_PIP_Id')]" 884 | } 885 | } 886 | } 887 | ], 888 | "backendAddressPools": [ 889 | { 890 | "name": "BackendPool1" 891 | } 892 | ], 893 | "inboundNatRules": [ 894 | { 895 | "name": "RDP-VM0", 896 | "properties": { 897 | "frontendIPConfiguration": { 898 | "id": "[variables('frontEndIPConfigID')]" 899 | }, 900 | "protocol": "Tcp", 901 | "frontendPort": 50001, 902 | "backendPort": 3389, 903 | "enableFloatingIP": false 904 | } 905 | }, 906 | { 907 | "name": "RDP-VM1", 908 | "properties": { 909 | "frontendIPConfiguration": { 910 | "id": "[variables('frontEndIPConfigID')]" 911 | }, 912 | "protocol": "Tcp", 913 | "frontendPort": 50002, 914 | "backendPort": 3389, 915 | "enableFloatingIP": false 916 | } 917 | } 918 | ], 919 | "loadBalancingRules": [ 920 | { 921 | "name": "LBRule", 922 | "properties": { 923 | "frontendIPConfiguration": { 924 | "id": "[variables('frontEndIPConfigID')]" 925 | }, 926 | "backendAddressPool": { 927 | "id": "[variables('lbPoolID')]" 928 | }, 929 | "protocol": "Tcp", 930 | "frontendPort": 80, 931 | "backendPort": 80, 932 | "enableFloatingIP": false, 933 | "idleTimeoutInMinutes": 5, 934 | "probe": { 935 | "id": "[variables('lbProbeID')]" 936 | } 937 | } 938 | } 939 | ], 940 | "probes": [ 941 | { 942 | "name": "tcpProbe", 943 | "properties": { 944 | "protocol": "Tcp", 945 | "port": 80, 946 | "intervalInSeconds": 5, 947 | "numberOfProbes": 2 948 | } 949 | } 950 | ] 951 | } 952 | }, 953 | { 954 | "name": "[concat(variables('webSrvNicName'), copyindex())]", 955 | "type": "Microsoft.Network/networkInterfaces", 956 | "location": "[parameters('location')]", 957 | "apiVersion": "2015-06-15", 958 | "copy": { 959 | "name": "nicLoop", 960 | "count": "[variables('webSrvNumbOfInstances')]" 961 | }, 962 | "dependsOn": [ 963 | "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", 964 | "[concat('Microsoft.Network/loadBalancers/', variables('webLbName'))]" 965 | ], 966 | "tags": { 967 | "displayName": "WebSrvNic" 968 | }, 969 | "properties": { 970 | "ipConfigurations": [ 971 | { 972 | "name": "ipconfig1", 973 | "properties": { 974 | "privateIPAllocationMethod": "Dynamic", 975 | "subnet": { 976 | "id": "[variables('webSrvSubnetRef')]" 977 | }, 978 | "loadBalancerBackendAddressPools": [ 979 | { 980 | "id": "[concat(variables('webLbId'), '/backendAddressPools/BackendPool1')]" 981 | } 982 | ], 983 | "loadBalancerInboundNatRules": [ 984 | { 985 | "id": "[concat(variables('webLbId'),'/inboundNatRules/RDP-VM', copyindex())]" 986 | } 987 | ] 988 | } 989 | } 990 | ] 991 | } 992 | }, 993 | { 994 | "name": "[concat(variables('webSrvName'), copyindex())]", 995 | "type": "Microsoft.Compute/virtualMachines", 996 | "location": "[parameters('location')]", 997 | "apiVersion": "2017-03-30", 998 | "copy": { 999 | "name": "webSrvMachineLoop", 1000 | "count": "[variables('webSrvNumbOfInstances')]" 1001 | }, 1002 | "dependsOn": [ 1003 | "[concat('Microsoft.Network/networkInterfaces/', variables('webSrvNicName'), copyindex())]", 1004 | "[concat('Microsoft.Compute/availabilitySets/', variables('webSrvAvailabilitySetName'))]" 1005 | ], 1006 | "tags": { 1007 | "displayName": "WebSrv" 1008 | }, 1009 | "properties": { 1010 | "availabilitySet": { 1011 | "id": "[resourceId('Microsoft.Compute/availabilitySets',variables('webSrvAvailabilitySetName'))]" 1012 | }, 1013 | "hardwareProfile": { 1014 | "vmSize": "[variables('webSrvVMSize')]" 1015 | }, 1016 | "osProfile": { 1017 | "computerName": "[concat(variables('webSrvName'),copyindex())]", 1018 | "adminUsername": "[parameters('username')]", 1019 | "adminPassword": "[parameters('password')]" 1020 | }, 1021 | "storageProfile": { 1022 | "imageReference": { 1023 | "publisher": "MicrosoftWindowsServer", 1024 | "offer": "WindowsServer", 1025 | "sku": "2016-Datacenter", 1026 | "version": "latest" 1027 | }, 1028 | "osDisk": { 1029 | "name": "[concat(concat(variables('webSrvName'),copyindex(),'_OSDisk'))]", 1030 | "caching": "ReadWrite", 1031 | "createOption": "FromImage", 1032 | "managedDisk": { 1033 | "storageAccountType": "[parameters('diskType')]" 1034 | } 1035 | } 1036 | }, 1037 | "networkProfile": { 1038 | "networkInterfaces": [ 1039 | { 1040 | "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('webSrvNicName'), copyindex()))]" 1041 | } 1042 | ] 1043 | } 1044 | }, 1045 | "resources": [ 1046 | { 1047 | "name": "[concat(variables('webSrvName'), copyindex(), '/', 'IaaSDiagnostics')]", 1048 | "type": "Microsoft.Compute/virtualMachines/extensions", 1049 | "apiVersion": "2017-12-01", 1050 | "location": "[parameters('location')]", 1051 | "dependsOn": [ 1052 | "[concat('Microsoft.Compute/virtualMachines/' ,variables('webSrvName'), copyindex())]" 1053 | ], 1054 | "properties": { 1055 | "publisher": "Microsoft.Azure.Diagnostics", 1056 | "type": "IaaSDiagnostics", 1057 | "typeHandlerVersion": "1.5", 1058 | "autoUpgradeMinorVersion": true, 1059 | "settings": { 1060 | "StorageAccount": "[variables('storageAccountName')]", 1061 | "WadCfg": { 1062 | "DiagnosticMonitorConfiguration": { 1063 | "overallQuotaInMB": 5120, 1064 | "Metrics": { 1065 | "resourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/', 'Microsoft.Compute/virtualMachines/', variables('VisualStudioSrvName'))]", 1066 | "MetricAggregation": [ 1067 | { 1068 | "scheduledTransferPeriod": "PT1H" 1069 | }, 1070 | { 1071 | "scheduledTransferPeriod": "PT1M" 1072 | } 1073 | ] 1074 | }, 1075 | "DiagnosticInfrastructureLogs": { 1076 | "scheduledTransferLogLevelFilter": "Error" 1077 | }, 1078 | "PerformanceCounters": { 1079 | "scheduledTransferPeriod": "PT1M", 1080 | "PerformanceCounterConfiguration": [ 1081 | { 1082 | "counterSpecifier": "\\Processor Information(_Total)\\% Processor Time", 1083 | "sampleRate": "PT1M" 1084 | }, 1085 | { 1086 | "counterSpecifier": "\\Processor Information(_Total)\\% Privileged Time", 1087 | "sampleRate": "PT1M" 1088 | }, 1089 | { 1090 | "counterSpecifier": "\\Processor Information(_Total)\\% User Time", 1091 | "sampleRate": "PT1M" 1092 | }, 1093 | { 1094 | "counterSpecifier": "\\Processor Information(_Total)\\Processor Frequency", 1095 | "sampleRate": "PT1M" 1096 | }, 1097 | { 1098 | "counterSpecifier": "\\System\\Processes", 1099 | "sampleRate": "PT1M" 1100 | }, 1101 | { 1102 | "counterSpecifier": "\\Process(_Total)\\Thread Count", 1103 | "sampleRate": "PT1M" 1104 | }, 1105 | { 1106 | "counterSpecifier": "\\Process(_Total)\\Handle Count", 1107 | "sampleRate": "PT1M" 1108 | }, 1109 | { 1110 | "counterSpecifier": "\\System\\System Up Time", 1111 | "sampleRate": "PT1M" 1112 | }, 1113 | { 1114 | "counterSpecifier": "\\System\\Context Switches/sec", 1115 | "sampleRate": "PT1M" 1116 | }, 1117 | { 1118 | "counterSpecifier": "\\System\\Processor Queue Length", 1119 | "sampleRate": "PT1M" 1120 | }, 1121 | { 1122 | "counterSpecifier": "\\Memory\\% Committed Bytes In Use", 1123 | "sampleRate": "PT1M" 1124 | }, 1125 | { 1126 | "counterSpecifier": "\\Memory\\Available Bytes", 1127 | "sampleRate": "PT1M" 1128 | }, 1129 | { 1130 | "counterSpecifier": "\\Memory\\Committed Bytes", 1131 | "sampleRate": "PT1M" 1132 | }, 1133 | { 1134 | "counterSpecifier": "\\Memory\\Cache Bytes", 1135 | "sampleRate": "PT1M" 1136 | }, 1137 | { 1138 | "counterSpecifier": "\\Memory\\Pool Paged Bytes", 1139 | "sampleRate": "PT1M" 1140 | }, 1141 | { 1142 | "counterSpecifier": "\\Memory\\Pool Nonpaged Bytes", 1143 | "sampleRate": "PT1M" 1144 | }, 1145 | { 1146 | "counterSpecifier": "\\Memory\\Pages/sec", 1147 | "sampleRate": "PT1M" 1148 | }, 1149 | { 1150 | "counterSpecifier": "\\Memory\\Page Faults/sec", 1151 | "sampleRate": "PT1M" 1152 | }, 1153 | { 1154 | "counterSpecifier": "\\Process(_Total)\\Working Set", 1155 | "sampleRate": "PT1M" 1156 | }, 1157 | { 1158 | "counterSpecifier": "\\Process(_Total)\\Working Set - Private", 1159 | "sampleRate": "PT1M" 1160 | }, 1161 | { 1162 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Time", 1163 | "sampleRate": "PT1M" 1164 | }, 1165 | { 1166 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Read Time", 1167 | "sampleRate": "PT1M" 1168 | }, 1169 | { 1170 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Write Time", 1171 | "sampleRate": "PT1M" 1172 | }, 1173 | { 1174 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Idle Time", 1175 | "sampleRate": "PT1M" 1176 | }, 1177 | { 1178 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Bytes/sec", 1179 | "sampleRate": "PT1M" 1180 | }, 1181 | { 1182 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Read Bytes/sec", 1183 | "sampleRate": "PT1M" 1184 | }, 1185 | { 1186 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Write Bytes/sec", 1187 | "sampleRate": "PT1M" 1188 | }, 1189 | { 1190 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Transfers/sec", 1191 | "sampleRate": "PT1M" 1192 | }, 1193 | { 1194 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Reads/sec", 1195 | "sampleRate": "PT1M" 1196 | }, 1197 | { 1198 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Writes/sec", 1199 | "sampleRate": "PT1M" 1200 | }, 1201 | { 1202 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Transfer", 1203 | "sampleRate": "PT1M" 1204 | }, 1205 | { 1206 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Read", 1207 | "sampleRate": "PT1M" 1208 | }, 1209 | { 1210 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Write", 1211 | "sampleRate": "PT1M" 1212 | }, 1213 | { 1214 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Queue Length", 1215 | "sampleRate": "PT1M" 1216 | }, 1217 | { 1218 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Read Queue Length", 1219 | "sampleRate": "PT1M" 1220 | }, 1221 | { 1222 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Write Queue Length", 1223 | "sampleRate": "PT1M" 1224 | }, 1225 | { 1226 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Free Space", 1227 | "sampleRate": "PT1M" 1228 | }, 1229 | { 1230 | "counterSpecifier": "\\LogicalDisk(_Total)\\Free Megabytes", 1231 | "sampleRate": "PT1M" 1232 | }, 1233 | { 1234 | "counterSpecifier": "\\Network Interface(*)\\Bytes Total/sec", 1235 | "sampleRate": "PT1M" 1236 | }, 1237 | { 1238 | "counterSpecifier": "\\Network Interface(*)\\Bytes Sent/sec", 1239 | "sampleRate": "PT1M" 1240 | }, 1241 | { 1242 | "counterSpecifier": "\\Network Interface(*)\\Bytes Received/sec", 1243 | "sampleRate": "PT1M" 1244 | }, 1245 | { 1246 | "counterSpecifier": "\\Network Interface(*)\\Packets/sec", 1247 | "sampleRate": "PT1M" 1248 | }, 1249 | { 1250 | "counterSpecifier": "\\Network Interface(*)\\Packets Sent/sec", 1251 | "sampleRate": "PT1M" 1252 | }, 1253 | { 1254 | "counterSpecifier": "\\Network Interface(*)\\Packets Received/sec", 1255 | "sampleRate": "PT1M" 1256 | }, 1257 | { 1258 | "counterSpecifier": "\\Network Interface(*)\\Packets Outbound Errors", 1259 | "sampleRate": "PT1M" 1260 | }, 1261 | { 1262 | "counterSpecifier": "\\Network Interface(*)\\Packets Received Errors", 1263 | "sampleRate": "PT1M" 1264 | } 1265 | ] 1266 | }, 1267 | "WindowsEventLog": { 1268 | "scheduledTransferPeriod": "PT1M", 1269 | "DataSource": [ 1270 | { 1271 | "name": "Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]" 1272 | }, 1273 | { 1274 | "name": "Security!*[System[band(Keywords,4503599627370496)]]" 1275 | }, 1276 | { 1277 | "name": "System!*[System[(Level = 1 or Level = 2 or Level = 3)]]" 1278 | } 1279 | ] 1280 | } 1281 | } 1282 | } 1283 | }, 1284 | "protectedSettings": { 1285 | "storageAccountName": "[variables('storageAccountName')]", 1286 | "storageAccountKey": "[listKeys(variables('storageAccountId'),'2015-06-15').key1]", 1287 | "storageAccountEndPoint": "https://core.windows.net/" 1288 | } 1289 | } 1290 | }, 1291 | { 1292 | "type": "extensions", 1293 | "name": "CustomScriptExtension", 1294 | "apiVersion": "2017-03-30", 1295 | "location": "[resourceGroup().location]", 1296 | "dependsOn": [ 1297 | "[concat('Microsoft.Compute/virtualMachines/' ,variables('webSrvName'), copyindex())]" 1298 | ], 1299 | "properties": { 1300 | "publisher": "Microsoft.Compute", 1301 | "type": "CustomScriptExtension", 1302 | "typeHandlerVersion": "1.8", 1303 | "autoUpgradeMinorVersion": true, 1304 | "settings": { 1305 | "fileUris": [ 1306 | "https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/master/SetupWebServers.ps1" 1307 | ], 1308 | "commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File SetupWebServers.ps1 ', ' ', variables('VisualStudioSrvName'))]" 1309 | } 1310 | } 1311 | } 1312 | ] 1313 | } 1314 | ] 1315 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Azure Monitoring Hackathon 2 | 3 | ## Overview 4 | 5 | ### This challenged based Azure Monitoring Hackathon is intended to teach how to monitor Azure workloads. During these three days you will be working Azure Monitor, Log Analytics and Application Insights. 6 | 7 | [Setup Guide](https://github.com/rkuehfus/AzureMonitoringHackathon/blob/master/Student/Guides/Deployment%20Setup%20Guide.docx?raw=true) 8 | 9 | [Challenges](https://github.com/rkuehfus/AzureMonitoringHackathon/blob/master/Student/Guides/Challenges.pptx?raw=true) 10 | 11 | [Proctors Guide](https://github.com/rkuehfus/AzureMonitoringHackathon/blob/master/Host/Guides/Proctors%20Guide.docx?raw=true) 12 | 13 | ## Goals 14 | 15 | ### 1. Build attendees technical skills on Monitoring workloads in Azure 16 | 17 | ### 2. Understand what Monitoring Tools are available in Azure and how to implement them. 18 | 19 | ## Prerequisites 20 | 21 | ### 1. Attendees have access to an Azure Subscription where they can each deploy the provided ARM template that will build a very detailed infrastructure to monitor.  This includes the Vnet, subnets, NSG(s), LB(s), NAT rules, Scales Set and a fully functional .NET Core Application (eShopOnWeb) to monitor. 22 | 23 | ### 2.Attendees should have a level 200-300 understanding of the Azure platform.  Understand concepts like PowerShell, Azure Cli, ARM, resource groups, RBAC, network, storage, compute, Scale Sets, virtual machines and security.  Previous experience working with ARM templates is recommended. 24 | 25 | ### 3. Access to a machine with Visual Studio Code and the Azure PowerShell Modules loaded or Azure CLI. VS Code ARM and PowerShell extensions should be configured. 26 | 27 | ![alt text](https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/master/monitoringhackdiagram.png) 28 | 29 | # Agenda 30 | 31 | ## Day 1 32 | 33 | ### 9 – 9:30 AM: Kickoff & Introductions 34 | 35 | ### 9:30 - 10:30 AM: Deploy Lab 36 | 37 | ### 10:30 - 10:45 AM: Break 38 | 39 | ### 10:45 - Noon: Azure Security & Management and Monitor Overviews 40 | 41 | ### Noon – 1 PM: Lunch 42 | 43 | ### 1 – 3 PM: Monitor and Alert Rule Challenges begin 44 | 45 | ### 3 – 3:15 PM: Break 46 | 47 | ### 3:15 – 5 PM: Monitor and Alert Rule Automation Challenges begins 48 | 49 | ## Day 2 50 | 51 | ### 9 – 9:30 AM: Team Sync up (what did you learn from Day 1?, how did it go?, blocked?) 52 | 53 | ### 9:30 - 10:15 AM: Log Analytics Overview 54 | 55 | ### 10:15 - 10:30 AM: Break 56 | 57 | ### 10:30 - Noon: Log Analytics Challenges Start 58 | 59 | ### Noon – 1 PM: Lunch 60 | 61 | ### 1 – 3 PM: Log Analytics Dashboard Challenges Start 62 | 63 | ### 3 – 3:15 PM: break 64 | 65 | ### 3:15 – 5 PM: Log Analytics Challanges (complete) 66 | 67 | ## Day 3 68 | 69 | ### 9 – 9:30 AM: Team Sync up (what did you learn from Day 2?, how did it go?, blocked?) 70 | 71 | ### 9:30 - 10:15 AM: App Insights Overview 72 | 73 | ### 10:15 - 10:30 AM: Break 74 | 75 | ### 10:30 - Noon: App Insights Challenges Start 76 | 77 | ### Noon – 1 PM: Lunch 78 | 79 | ### 1 – 3 PM: App Insights Challenges Continues 80 | 81 | ### 3 – 4 PM: Plan & Whiteboard Monitoring for existing Application 82 | 83 | 84 | -------------------------------------------------------------------------------- /Student/Guides/Challenges.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Student/Guides/Challenges.pptx -------------------------------------------------------------------------------- /Student/Guides/Deployment Setup Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Student/Guides/Deployment Setup Guide.docx -------------------------------------------------------------------------------- /Student/Guides/HammerDB Setup Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/Student/Guides/HammerDB Setup Guide.docx -------------------------------------------------------------------------------- /Student/Resources/AlertsTemplate/GenerateAlertRules.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "alertVMs": { 6 | "type": "array", 7 | "metadata": { 8 | "description": "" 9 | } 10 | }, 11 | "alertSeverity": { 12 | "type": "int", 13 | "defaultValue": 2, 14 | "allowedValues": [ 15 | 0, 16 | 1, 17 | 2, 18 | 3, 19 | 4 20 | ], 21 | "metadata": { 22 | "description": "Sev 0 = Critical, Sev 1 = Error, Sev 2 = Warning, Sev 3 = Informational, Sev 4 = Verbose" 23 | } 24 | }, 25 | "isEnabled": { 26 | "type": "bool", 27 | "defaultValue": true 28 | }, 29 | "actionGroupId": { 30 | "type": "string", 31 | "metadata": { 32 | "description": "" 33 | } 34 | } 35 | }, 36 | "variables": {}, 37 | "resources": [ 38 | { 39 | "type": "Microsoft.Insights/metricAlerts", 40 | "name": "[concat('Network_In_Alert','-',parameters('alertVMs')[copyIndex()])]", 41 | "copy": { 42 | "name": "iterator", 43 | "count": "[length(parameters('alertVMs'))]" 44 | }, 45 | "apiVersion": "2018-03-01", 46 | "location": "global", 47 | "tags": {}, 48 | "scale": null, 49 | "properties": { 50 | "description": "Network In metric has detected a large amount of inbound traffic", 51 | "severity": "[parameters('alertSeverity')]", 52 | "enabled": "[parameters('isEnabled')]", 53 | "scopes": [ 54 | "[resourceId('Microsoft.Compute/virtualMachines', parameters('alertVMs')[copyIndex()])]" 55 | ], 56 | "evaluationFrequency": "PT5M", 57 | "windowSize": "PT5M", 58 | "criteria": { 59 | "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", 60 | "allOf": [ 61 | { 62 | "name": "MetricNetIn", 63 | "metricName": "Network In", 64 | "dimensions": [], 65 | "operator": "GreaterThan", 66 | "threshold": 4000000, 67 | "timeAggregation": "Average" 68 | } 69 | ] 70 | }, 71 | "actions": [ 72 | { 73 | "actionGroupId": "[parameters('actionGroupId')]", 74 | "webHookProperties": {} 75 | } 76 | ] 77 | }, 78 | "dependsOn": [] 79 | }, 80 | { 81 | "type": "Microsoft.Insights/metricAlerts", 82 | "name": "[concat('CPU_Alert','-',parameters('alertVMs')[copyIndex()])]", 83 | "copy": { 84 | "name": "iterator", 85 | "count": "[length(parameters('alertVMs'))]" 86 | }, 87 | "apiVersion": "2018-03-01", 88 | "location": "global", 89 | "properties": { 90 | "description": "Alert for CPU Usage over 75 percent", 91 | "severity": "[parameters('alertSeverity')]", 92 | "enabled": "[parameters('isEnabled')]", 93 | "scopes": [ 94 | "[resourceId('Microsoft.Compute/virtualMachines', parameters('alertVMs')[copyIndex()])]" 95 | ], 96 | "evaluationFrequency": "PT1M", 97 | "windowSize": "PT5M", 98 | "templateType": 8, 99 | "templateSpecificParameters": {}, 100 | "criteria": { 101 | "allOf": [ 102 | { 103 | "name": "MetricCPU", 104 | "metricNamespace": "Microsoft.Compute/virtualMachines", 105 | "metricName": "Percentage CPU", 106 | "dimensions": [], 107 | "operator": "GreaterThan", 108 | "threshold": 75, 109 | "monitorTemplateType": 8, 110 | "timeAggregation": "Average", 111 | "criterionType": "StaticThresholdCriterion" 112 | } 113 | ], 114 | "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" 115 | }, 116 | "autoMitigate": true, 117 | "actions": [ 118 | { 119 | "actionGroupId": "[parameters('actionGroupId')]" 120 | } 121 | ] 122 | } 123 | } 124 | ], 125 | "outputs": {} 126 | } -------------------------------------------------------------------------------- /Student/Resources/AlertsTemplate/deployAlertRules.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "actionGroupId": { 6 | "value": "" 7 | }, 8 | "alertVMs": { 9 | "value": [ 10 | "xxxxxsqlSrv16", 11 | "xxxxxVSSrv17" 12 | ] 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Student/Resources/AlertsTemplate/deployAlertRulesTemplate.ps1: -------------------------------------------------------------------------------- 1 | Connect-AzureRmAccount 2 | 3 | #Specify your resourcegroup 4 | $rgname="" 5 | $rg = Get-AzureRmResourceGroup -Name $rgname 6 | 7 | #Get Azure Monitor Action Group 8 | (Get-AzureRmResource -ResourceType 'Microsoft.Insights/actiongroups').ResourceId 9 | 10 | #Update Path to files as needed 11 | #Update the parameters file with the names of your VMs and the ResourceId of your Action Group (use command above to find ResourceId) 12 | $template=".\AlertsTemplate\GenerateAlertRules.json" 13 | $para=".\AlertsTemplate\deployAlertRules.parameters.json" 14 | 15 | $job = 'job.' + ((Get-Date).ToUniversalTime()).tostring("MMddyy.HHmm") 16 | New-AzureRmResourceGroupDeployment ` 17 | -Name $job ` 18 | -ResourceGroupName $rg.ResourceGroupName ` 19 | -TemplateFile $template ` 20 | -TemplateParameterFile $para 21 | 22 | 23 | #Note: At the time I created this, the PowerShell cmdlet was targeting the wrong resourceType and is scheduled to be updated 24 | #To check your results - Get metrixAlerts Rule for Resourcegroup 25 | Get-AzureRmResource -ResourceGroupName $rg.ResourceGroupName -ResourceType 'Microsoft.Insights/metricalerts' -Name CPU*| ft 26 | 27 | #To delete your Alert Rules 28 | Get-AzureRmResource -ResourceGroupName $rg.ResourceGroupName -ResourceType 'Microsoft.Insights/metricalerts' -Name CPU* | Remove-AzureRmResource -Force -------------------------------------------------------------------------------- /Student/Resources/AlertsTemplate/deployAlertRulesTemplate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Bash script to find the Action Group id and then deploy the alert rules template 4 | # Tip: Show the Integrated Terminal from View\Integrated Terminal or Ctrl+` 5 | # Tip: highlight a line, press Ctrl+Shift+P and then "Terminal: Run Selected Text in Active Terminal" to run the line of code! 6 | 7 | # Step 0: Test for the 'jq' program which will be needed 8 | declare jqPath=$(which jq) 9 | if [ ! -f $jqPath ] 10 | then 11 | echo 'This script requires that the "jq" utility is installed and on your path' 12 | exit 1 13 | fi 14 | 15 | # Step 1: Use a name no longer then five charactors all LOWERCASE. Your initials would work well if working in the same sub as others. 16 | declare resourceGroupName="" 17 | 18 | # Step 2: Get the Azure Monitor Action Group name and resource id 19 | az resource list --resource-type 'Microsoft.Insights/actiongroups' -g $resourceGroupName -o json | jq '.[0] | {id: .id, name: .name}' 20 | 21 | # Step 3: Update Path to files as needed 22 | # Update the parameters file with the names of your VMs and the ResourceId of your Action Group (use command above to find ResourceId) 23 | declare template="./GenerateAlertRules.json" 24 | declare para="./deployAlertRules.parameters.json" 25 | 26 | # Step 4: Kick off the deployment 27 | declare job="job.$(date '+%Y%m%d.%H%m')" 28 | az group deployment create --name $job -g $resourceGroupName --template-file $template --parameters @$para 29 | 30 | # Step 5: To check your results - Get metricalerts Rule for Resourcegroup beginning with a name of "CPU" 31 | az resource list --resource-type 'Microsoft.Insights/metricalerts' -g $resourceGroupName -o json | jq '.[] | select(.name|test("^CPU_"))' 32 | -------------------------------------------------------------------------------- /Student/Resources/DeployMonHackEnv.ps1: -------------------------------------------------------------------------------- 1 | #PowerShell Commands to create an Azure Key Vault and deployment for Monitoring Hackathon 2 | #Make sure to install the VS Code extension for PowerShell 3 | #Tip: Show the Integrated Terminal from View\Integrated Terminal 4 | #Tip: click on a line and press "F8" to run the line of code 5 | 6 | #Make sure you are running the latest version of the Azure PowerShell modules, uncomment the line below and run it (F8) 7 | # Install-Module -Name AzureRM -Force -Scope CurrentUser -AllowClobber 8 | 9 | #Step 1: Use a name no longer then five charactors all lowercase. Your initials would work well if working in the same sub as others. 10 | $MonitoringHackName = 'your-initials-here' 11 | 12 | #Step 2: Create ResourceGroup after updating the location to one of your choice. Use get-AzureRmLocation to see a list 13 | Connect-AzureRmAccount 14 | New-AzureRMResourceGroup -Name $MonitoringHackName -Location 'East US' #The hack uses a few features in preview so its best to leave this in East US 15 | $rg = get-AzureRmresourcegroup -Name $MonitoringHackName 16 | 17 | #Step 3: Create Key Vault and set flag to enable for template deployment with ARM 18 | $MonitoringHackVaultName = $MonitoringHackName + 'MonitoringHackVault' 19 | New-AzureRmKeyVault -VaultName $MonitoringHackVaultName -ResourceGroupName $rg.ResourceGroupName -Location $rg.Location -EnabledForTemplateDeployment 20 | 21 | #Step 4: Add password as a secret. Note:this will prompt you for a user and password. User should be vmadmin and a password that meet the azure pwd police like P@ssw0rd123!! 22 | Set-AzureKeyVaultSecret -VaultName $MonitoringHackVaultName -Name "VMPassword" -SecretValue (Get-Credential).Password 23 | 24 | #Step 5: Update azuredeploy.parameters.json file with your envPrefixName and Key Vault info example- /subscriptions/{guid}/resourceGroups/{group-name}/providers/Microsoft.KeyVault/vaults/{vault-name} 25 | (Get-AzureRmKeyVault -VaultName $MonitoringHackVaultName).ResourceId 26 | 27 | #Step 6: Run deployment below after updating and SAVING the parameter file with your key vault info. Make sure to update the paths to the json files or run the command from the same directory 28 | #Note: You may want to adjust the VM series deployed in the ARM template. Feel free to modify the ARM template to use a different VM Series. 29 | New-AzureRmResourceGroupDeployment -Name $MonitoringHackName -ResourceGroupName $MonitoringHackName -TemplateFile '.\VMSSazuredeploy.json' -TemplateParameterFile '.\azuredeploy.parameters.json' -------------------------------------------------------------------------------- /Student/Resources/DeployMonHackEnv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Azure CLI Commands to create an Azure Key Vault and deployment for Monitoring Hackathon 4 | #Tip: Show the Integrated Terminal from View\Integrated Terminal or Ctrl+` 5 | #Tip: highlight a line, press Ctrl+Shift+P and then "Terminal: Run Selected Text in Active Terminal" to run the line of code! 6 | 7 | #Step 1: Use a name no longer then five charactors all LOWERCASE. Your initials would work well if working in the same sub as others. 8 | declare monitoringHackName="yourinitialshere" 9 | declare location="eastus" 10 | 11 | #Step 2: Create ResourceGroup after updating the location to one of your choice. Use get-AzureRmLocation to see a list 12 | #Create a new Resource Group with YOUR name! 13 | az group create --name $monitoringHackName -l $location 14 | 15 | #Step 3: Create Key Vault and set flag to enable for template deployment with ARM 16 | declare vaultSuffix="MonitoringHackVault" 17 | declare monitoringHackVaultName="$monitoringHackName$vaultSuffix" 18 | az keyvault create --name $monitoringHackVaultName -g $monitoringHackName -l $location --enabled-for-template-deployment true 19 | 20 | #Step 4: Add password as a secret. Use a password that meets the azure pwd police like P@ssw0rd123!! 21 | read -s -p "Password for your VMs: " PASSWORD 22 | az keyvault secret set --vault-name $monitoringHackVaultName --name 'VMPassword' --value $PASSWORD 23 | 24 | #Step 5: Update azuredeploy.parameters.json file with your envPrefixName and Key Vault resourceID Example --> /subscriptions/{guid}/resourceGroups/{group-name}/providers/Microsoft.KeyVault/vaults/{vault-name} 25 | # Hint: Run the following line of code to retrieve the resourceID so you can cut and paste from the terminal into your parameters file! 26 | az keyvault show --name $monitoringHackVaultName -o json 27 | 28 | #Step 6: Run deployment below after updating and SAVING the parameter file with your key vault info. Make sure to update the paths to the json files or run the command from the same directory 29 | #Note: This will deploy VMs using DS3_v2 series VMs. By default a subscription is limited to 10 cores of DS Series per region. You may have to request more cores or 30 | # choice another region if you run into quota errors on your deployment. Also feel free to modify the ARM template to use a different VM Series. 31 | az group deployment create --name monitoringHackDeployment -g $monitoringHackName --template-file VMSSazuredeploy.json --parameters @azuredeploy.parameters.json 32 | -------------------------------------------------------------------------------- /Student/Resources/Loadscripts/UrlGenLoadwithCurl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # what's the url? 4 | declare myUrl="http://mon19webscalesetlb.eastus.cloudapp.azure.com" 5 | # how many times are we hitting it? 6 | declare numberOfHits=100 7 | 8 | # output what we're going to do 9 | echo "Using url: $myUrl" 10 | echo "Hitting it $numberOfHits times" 11 | 12 | # loop through and hit the url the requisite number of times 13 | for i in $( seq 1 $numberOfHits ) 14 | do 15 | curCode=$(curl -s -o /dev/null -w"%{http_code}\n" $myUrl) 16 | echo "Run #$i returned: $curCode" 17 | done 18 | 19 | -------------------------------------------------------------------------------- /Student/Resources/Loadscripts/UrlGenLoadwithPS.ps1: -------------------------------------------------------------------------------- 1 | for ($i = 0 ; $i -lt 100; $i++) 2 | { 3 | Invoke-WebRequest -uri http://monh3websrvlb.eastus.cloudapp.azure.com/ 4 | } -------------------------------------------------------------------------------- /Student/Resources/Loadscripts/cpuGenLoadwithPS.ps1: -------------------------------------------------------------------------------- 1 | $NumberofProcs = (Get-WMIObject win32_processor | Measure-Object NumberofLogicalProcessors -sum).sum 2 | #Updated based on anonymous feedback. 3 | $NumberofProcs= [int]$env:Number_of_Processors 4 | While ($NumberofProcs -ne 0) 5 | { 6 | $NumberofProcs-- 7 | Start-Process Powershell.exe -ArgumentList '"foreach ($loopnumber in 1..2147483647) {$result=1;foreach ($number in 1..2147483647) {$result = $result * $number};$result}"' 8 | } -------------------------------------------------------------------------------- /Student/Resources/Log Analytics/MonitoringHackSampleLAQueries.csl: -------------------------------------------------------------------------------- 1 | Perf 2 | | where ObjectName == "Processor" and CounterName == "% Processor Time" and TimeGenerated > ago(4h) 3 | | summarize AVGPROCESSOR = avg(CounterValue) by bin(TimeGenerated, 5m), Computer 4 | | sort by AVGPROCESSOR desc 5 | | render timechart 6 | 7 | //for dashboard 8 | Perf 9 | | where ObjectName == "Processor" and CounterName == "% Processor Time" and TimeGenerated > ago(4h) 10 | | summarize AVGPROCESSOR = avg(CounterValue) by bin(TimeGenerated, 5m), Computer 11 | 12 | Perf 13 | | where ObjectName == "Memory" and CounterName == "% Committed Bytes In Use" and TimeGenerated > ago(4h) 14 | | summarize AVGMEMORY = avg(CounterValue) by bin(TimeGenerated, 5m), Computer 15 | | sort by AVGMEMORY desc 16 | | render timechart 17 | 18 | //for dashboard 19 | Perf 20 | | where ObjectName == "Memory" and CounterName == "% Committed Bytes In Use" and TimeGenerated > ago(4h) 21 | | summarize AVGMEMORY = avg(CounterValue) by bin(TimeGenerated, 5m), Computer 22 | 23 | Perf 24 | | where CounterName == "Disk Reads/sec" and ObjectName == "LogicalDisk" and TimeGenerated > ago(4h) 25 | | summarize AvgReadsDiskIO = avg(CounterValue) by bin(TimeGenerated, 5m), Computer 26 | | sort by AvgReadsDiskIO desc 27 | | render timechart 28 | 29 | //for dashboard 30 | Perf 31 | | where CounterName == "Disk Reads/sec" and ObjectName == "LogicalDisk" and TimeGenerated > ago(4h) 32 | | summarize AvgReadsDiskIO = avg(CounterValue) by bin(TimeGenerated, 5m), Computer 33 | 34 | Perf 35 | | where CounterName == "Disk Writes/sec" and ObjectName == "LogicalDisk" and TimeGenerated > ago(4h) 36 | | summarize AvgDiskWritesIO = avg(CounterValue) by bin(TimeGenerated, 5m), Computer 37 | | sort by AvgDiskWritesIO desc 38 | | render timechart 39 | 40 | //for dashboard 41 | Perf 42 | | where CounterName == "Disk Writes/sec" and ObjectName == "LogicalDisk" and TimeGenerated > ago(4h) 43 | | summarize AvgDiskWritesIO = avg(CounterValue) by bin(TimeGenerated, 5m), Computer 44 | 45 | //heartbeat 46 | Heartbeat 47 | | summarize max(TimeGenerated) by Computer 48 | | where max_TimeGenerated < ago(15m) 49 | | count -------------------------------------------------------------------------------- /Student/Resources/Log Analytics/eShop Server Health.omsview: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "location": { 6 | "type": "string", 7 | "defaultValue": "" 8 | }, 9 | "resourcegroup": { 10 | "type": "string", 11 | "defaultValue": "" 12 | }, 13 | "subscriptionId": { 14 | "type": "string", 15 | "defaultValue": "" 16 | }, 17 | "workspace": { 18 | "type": "string", 19 | "defaultValue": "" 20 | }, 21 | "workspaceapiversion": { 22 | "type": "string", 23 | "defaultValue": "" 24 | } 25 | }, 26 | "resources": [ 27 | { 28 | "apiVersion": "[parameters('workspaceapiversion')]", 29 | "name": "[parameters('workspace')]", 30 | "type": "Microsoft.OperationalInsights/workspaces", 31 | "location": "[parameters('location')]", 32 | "id": "[Concat('/subscriptions/', parameters('subscriptionId'), '/resourceGroups/', parameters('resourcegroup'), '/providers/Microsoft.OperationalInsights/workspaces/', parameters('workspace'))]", 33 | "resources": [ 34 | { 35 | "apiVersion": "2015-11-01-preview", 36 | "name": "eShop Server Health", 37 | "type": "views", 38 | "location": "[parameters('location')]", 39 | "id": "[Concat('/subscriptions/', parameters('subscriptionId'), '/resourceGroups/', parameters('resourcegroup'), '/providers/Microsoft.OperationalInsights/workspaces/', parameters('workspace'),'/views/eShop Server Health')]", 40 | "dependson": [ 41 | "[Concat('/subscriptions/', parameters('subscriptionId'), '/resourceGroups/', parameters('resourcegroup'), '/providers/Microsoft.OperationalInsights/workspaces/', parameters('workspace'))]" 42 | ], 43 | "properties": { 44 | "Id": "eShop Server Health", 45 | "Name": "eShop Server Health", 46 | "Author": null, 47 | "Source": "Local", 48 | "Version": 2, 49 | "Dashboard": [ 50 | { 51 | "Id": "LineChartCalloutBuilderBlade", 52 | "Type": "Blade", 53 | "Version": 0, 54 | "Configuration": { 55 | "General": { 56 | "title": "Processor Performance", 57 | "newGroup": false, 58 | "icon": "", 59 | "useIcon": false 60 | }, 61 | "Header": { 62 | "Title": "% Processor Time", 63 | "Subtitle": "" 64 | }, 65 | "LineChart": { 66 | "Query": "Perf | where ObjectName == \"Processor\" and CounterName == \"% Processor Time\" and TimeGenerated > ago(4h) | summarize AVGPROCESSOR = avg(CounterValue) by bin(TimeGenerated, 5m), Computer", 67 | "Callout": { 68 | "Title": "Avg per 5 mins", 69 | "Series": "", 70 | "Operation": "Average" 71 | }, 72 | "yAxis": { 73 | "isLogarithmic": false, 74 | "units": { 75 | "baseUnitType": "Percentage", 76 | "baseUnit": "ZeroToOne", 77 | "displayUnit": "ZeroToOne" 78 | }, 79 | "customLabel": "" 80 | }, 81 | "NavigationSelect": {} 82 | }, 83 | "List": { 84 | "Query": "Perf | where ObjectName == \"Memory\" and CounterName == \"% Committed Bytes In Use\" and TimeGenerated > ago(4h) | summarize AVGMEMORY = avg(CounterValue) by bin(TimeGenerated, 5m), Computer", 85 | "HideGraph": false, 86 | "enableSparklines": true, 87 | "ColumnsTitle": { 88 | "Name": "Server", 89 | "Value": "Percent" 90 | }, 91 | "Color": "#fcd116", 92 | "thresholds": { 93 | "isEnabled": false, 94 | "values": [ 95 | { 96 | "name": "Normal", 97 | "threshold": "Default", 98 | "color": "#009e49", 99 | "isDefault": true 100 | }, 101 | { 102 | "name": "Warning", 103 | "threshold": "60", 104 | "color": "#fcd116", 105 | "isDefault": false 106 | }, 107 | { 108 | "name": "Error", 109 | "threshold": "90", 110 | "color": "#ba141a", 111 | "isDefault": false 112 | } 113 | ] 114 | }, 115 | "NameDSVSeparator": "", 116 | "NavigationQuery": "search {selected item} | sort by TimeGenerated desc", 117 | "NavigationSelect": { 118 | "NavigationQuery": "search {selected item} | sort by TimeGenerated desc" 119 | } 120 | } 121 | } 122 | }, 123 | { 124 | "Id": "LineChartCalloutBuilderBlade", 125 | "Type": "Blade", 126 | "Version": 0, 127 | "Configuration": { 128 | "General": { 129 | "title": "Memory", 130 | "newGroup": false, 131 | "icon": "", 132 | "useIcon": false 133 | }, 134 | "Header": { 135 | "Title": "Memory % committed", 136 | "Subtitle": "" 137 | }, 138 | "LineChart": { 139 | "Query": "Perf | where ObjectName == \"Memory\" and CounterName == \"% Committed Bytes In Use\" and TimeGenerated > ago(4h) | summarize AVGMEMORY = avg(CounterValue) by bin(TimeGenerated, 5m), Computer", 140 | "Callout": { 141 | "Title": "Avg per 5 mins", 142 | "Series": "", 143 | "Operation": "Average" 144 | }, 145 | "yAxis": { 146 | "isLogarithmic": false, 147 | "units": { 148 | "baseUnitType": "Percentage", 149 | "baseUnit": "ZeroToOne", 150 | "displayUnit": "ZeroToOne" 151 | }, 152 | "customLabel": "" 153 | }, 154 | "NavigationSelect": {} 155 | }, 156 | "List": { 157 | "Query": "Perf | where ObjectName == \"Memory\" and CounterName == \"% Committed Bytes In Use\" and TimeGenerated > ago(4h) | summarize AVGMEMORY = avg(CounterValue) by bin(TimeGenerated, 5m), Computer", 158 | "HideGraph": false, 159 | "enableSparklines": true, 160 | "ColumnsTitle": { 161 | "Name": "Server", 162 | "Value": "Percent" 163 | }, 164 | "Color": "#0072c6", 165 | "thresholds": { 166 | "isEnabled": true, 167 | "values": [ 168 | { 169 | "name": "Normal", 170 | "threshold": "Default", 171 | "color": "#009e49", 172 | "isDefault": true 173 | }, 174 | { 175 | "name": "Warning", 176 | "threshold": "60", 177 | "color": "#fcd116", 178 | "isDefault": false 179 | }, 180 | { 181 | "name": "Error", 182 | "threshold": "90", 183 | "color": "#ba141a", 184 | "isDefault": false 185 | } 186 | ] 187 | }, 188 | "NameDSVSeparator": "", 189 | "NavigationQuery": "search {selected item} | sort by TimeGenerated desc", 190 | "NavigationSelect": { 191 | "NavigationQuery": "search {selected item} | sort by TimeGenerated desc" 192 | } 193 | } 194 | } 195 | }, 196 | { 197 | "Id": "LineChartCalloutBuilderBlade", 198 | "Type": "Blade", 199 | "Version": 0, 200 | "Configuration": { 201 | "General": { 202 | "title": "Disk Read Performace", 203 | "newGroup": false, 204 | "icon": "", 205 | "useIcon": false 206 | }, 207 | "Header": { 208 | "Title": "Disk Read per Sec", 209 | "Subtitle": "" 210 | }, 211 | "LineChart": { 212 | "Query": "Perf | where CounterName == \"Disk Reads/sec\" and ObjectName == \"LogicalDisk\" and TimeGenerated > ago(4h) | summarize AvgReadsDiskIO = avg(CounterValue) by bin(TimeGenerated, 5m), Computer", 213 | "Callout": { 214 | "Title": "Avg per 5 Mins", 215 | "Series": "", 216 | "Operation": "Average" 217 | }, 218 | "yAxis": { 219 | "isLogarithmic": false, 220 | "units": { 221 | "baseUnitType": "", 222 | "baseUnit": "", 223 | "displayUnit": "" 224 | }, 225 | "customLabel": "" 226 | }, 227 | "NavigationSelect": {} 228 | }, 229 | "List": { 230 | "Query": "Perf | where CounterName == \"Disk Reads/sec\" and ObjectName == \"LogicalDisk\" and TimeGenerated > ago(4h) | summarize AvgReadsDiskIO = avg(CounterValue) by bin(TimeGenerated, 5m), Computer", 231 | "HideGraph": false, 232 | "enableSparklines": true, 233 | "operation": "Summary", 234 | "ColumnsTitle": { 235 | "Name": "Server", 236 | "Value": "Count" 237 | }, 238 | "Color": "#0072c6", 239 | "thresholds": { 240 | "isEnabled": true, 241 | "values": [ 242 | { 243 | "name": "Normal", 244 | "threshold": "Default", 245 | "color": "#009e49", 246 | "isDefault": true 247 | }, 248 | { 249 | "name": "Warning", 250 | "threshold": "100", 251 | "color": "#fcd116", 252 | "isDefault": false 253 | }, 254 | { 255 | "name": "Error", 256 | "threshold": "150", 257 | "color": "#ba141a", 258 | "isDefault": false 259 | } 260 | ] 261 | }, 262 | "NameDSVSeparator": "", 263 | "NavigationQuery": "search {selected item} | sort by TimeGenerated desc", 264 | "NavigationSelect": { 265 | "NavigationQuery": "search {selected item} | sort by TimeGenerated desc" 266 | } 267 | } 268 | } 269 | }, 270 | { 271 | "Id": "LineChartCalloutBuilderBlade", 272 | "Type": "Blade", 273 | "Version": 0, 274 | "Configuration": { 275 | "General": { 276 | "title": "Disk Write Performance", 277 | "newGroup": false, 278 | "icon": "", 279 | "useIcon": false 280 | }, 281 | "Header": { 282 | "Title": "Disk Writes per sec", 283 | "Subtitle": "" 284 | }, 285 | "LineChart": { 286 | "Query": "Perf | where CounterName == \"Disk Writes/sec\" and ObjectName == \"LogicalDisk\" and TimeGenerated > ago(4h) | summarize AvgDiskWritesIO = avg(CounterValue) by bin(TimeGenerated, 5m), Computer", 287 | "Callout": { 288 | "Title": "Avg per 5 Mins", 289 | "Series": "", 290 | "Operation": "Average" 291 | }, 292 | "yAxis": { 293 | "isLogarithmic": false, 294 | "units": { 295 | "baseUnitType": "", 296 | "baseUnit": "", 297 | "displayUnit": "" 298 | }, 299 | "customLabel": "" 300 | }, 301 | "NavigationSelect": {} 302 | }, 303 | "List": { 304 | "Query": "Perf | where CounterName == \"Disk Writes/sec\" and ObjectName == \"LogicalDisk\" and TimeGenerated > ago(4h) | summarize AvgDiskWritesIO = avg(CounterValue) by bin(TimeGenerated, 5m), Computer", 305 | "HideGraph": false, 306 | "enableSparklines": true, 307 | "operation": "Summary", 308 | "ColumnsTitle": { 309 | "Name": "Server", 310 | "Value": "Count" 311 | }, 312 | "Color": "#0072c6", 313 | "thresholds": { 314 | "isEnabled": true, 315 | "values": [ 316 | { 317 | "name": "Normal", 318 | "threshold": "Default", 319 | "color": "#009e49", 320 | "isDefault": true 321 | }, 322 | { 323 | "name": "Warning", 324 | "threshold": "100", 325 | "color": "#fcd116", 326 | "isDefault": false 327 | }, 328 | { 329 | "name": "Error", 330 | "threshold": "120", 331 | "color": "#ba141a", 332 | "isDefault": false 333 | } 334 | ] 335 | }, 336 | "NameDSVSeparator": "", 337 | "NavigationQuery": "search {selected item} | sort by TimeGenerated desc", 338 | "NavigationSelect": { 339 | "NavigationQuery": "search {selected item} | sort by TimeGenerated desc" 340 | } 341 | } 342 | } 343 | } 344 | ], 345 | "Filters": [], 346 | "OverviewTile": { 347 | "Id": "SingleNumberBuilderTile", 348 | "Type": "OverviewTile", 349 | "Version": 2, 350 | "Configuration": { 351 | "Tile": { 352 | "Legend": "Unhealthy Virtual Machines", 353 | "Query": "Heartbeat | summarize max(TimeGenerated) by Computer | where max_TimeGenerated < ago(15m) | count" 354 | }, 355 | "Advanced": { 356 | "DataFlowVerification": { 357 | "Enabled": false, 358 | "Query": "search * | limit 1 | project TimeGenerated", 359 | "Message": "" 360 | } 361 | } 362 | } 363 | } 364 | } 365 | } 366 | ] 367 | } 368 | ] 369 | } -------------------------------------------------------------------------------- /Student/Resources/SetupVSServer.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [string]$SQLServerName, 3 | [string]$SQLpassword 4 | ) 5 | 6 | # Install Microsoft .Net Core 2.2.101 7 | $exeDotNetTemp = [System.IO.Path]::GetTempPath().ToString() + "dotnet-sdk-2.2.101-win-x64.exe" 8 | if (Test-Path $exeDotNetTemp) { Remove-Item $exeDotNetTemp -Force } 9 | # Download file from Microsoft Downloads and save to local temp file (%LocalAppData%/Temp/2) 10 | $exeFileNetCore = [System.IO.Path]::GetTempFileName() | Rename-Item -NewName "dotnet-sdk-2.2.101-win-x64.exe" -PassThru 11 | Invoke-WebRequest -Uri "https://download.visualstudio.microsoft.com/download/pr/d4592a50-b583-434a-bcda-529e506a7e0d/b1fee3bb02e4d5b831bd6057af67a91b/dotnet-sdk-2.2.101-win-x64.exe" -OutFile $exeFileNetCore 12 | # Run the exe with arguments 13 | $proc = (Start-Process -FilePath $exeFileNetCore.Name.ToString() -ArgumentList ('/install','/quiet') -WorkingDirectory $exeFileNetCore.Directory.ToString() -Passthru) 14 | $proc | Wait-Process 15 | 16 | # Disable Internet Explorer Enhanced Security Configuration 17 | $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" 18 | $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" 19 | Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force 20 | Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force 21 | Stop-Process -Name Explorer -Force 22 | 23 | # Download eShopOnWeb to c:\eShopOnWeb and extract contents 24 | $zipFileeShopTemp = [System.IO.Path]::GetTempPath().ToString() + "eShopOnWeb-master.zip" 25 | if (Test-Path $zipFileeShopTemp) { Remove-Item $zipFileeShopTemp -Force } 26 | $zipFileeShop = [System.IO.Path]::GetTempFileName() | Rename-Item -NewName "eShopOnWeb-master.zip" -PassThru 27 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 28 | Invoke-WebRequest -Uri "https://github.com/dotnet-architecture/eShopOnWeb/archive/master.zip" -OutFile $zipFileeShop 29 | $BackUpPath = $zipFileeShop.FullName 30 | New-Item -Path c:\eshoponweb -ItemType directory -Force 31 | $Destination = "C:\eshoponweb" 32 | Add-Type -assembly "system.io.compression.filesystem" -PassThru 33 | [io.compression.zipfile]::ExtractToDirectory($BackUpPath, $destination) 34 | 35 | #Update eShopOnWeb project to use SQL Server 36 | #modify Startup.cs 37 | $Startupfile = 'C:\eshoponweb\eShopOnWeb-master\src\Web\Startup.cs' 38 | $find = ' ConfigureInMemoryDatabases(services);' 39 | $replace = ' //ConfigureInMemoryDatabases(services);' 40 | (Get-Content $Startupfile).replace($find, $replace) | Set-Content $Startupfile -Force 41 | $find1 = ' // ConfigureProductionServices(services);' 42 | $replace1 = ' ConfigureProductionServices(services);' 43 | (Get-Content $Startupfile).replace($find1, $replace1) | Set-Content $Startupfile -Force 44 | 45 | #modify appsettings.json 46 | $SQLusername = "sqladmin" 47 | $appsettingsfile = 'C:\eshoponweb\eShopOnWeb-master\src\Web\appsettings.json' 48 | $find = ' "CatalogConnection": "Server=(localdb)\\mssqllocaldb;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.CatalogDb;",' 49 | $replace = ' "CatalogConnection": "Server=' + $SQLServername + ';Integrated Security=false;User ID=' + $SQLusername + ';Password=' + $SQLpassword + ';Initial Catalog=Microsoft.eShopOnWeb.CatalogDb;",' 50 | (Get-Content $appsettingsfile).replace($find, $replace) | Set-Content $appsettingsfile -Force 51 | $find1 = ' "IdentityConnection": "Server=(localdb)\\mssqllocaldb;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.Identity;"' 52 | $replace1 = ' "IdentityConnection": "Server=' + $SQLServername + ';Integrated Security=false;User ID=' + $SQLusername + ';Password=' + $SQLpassword + ';Initial Catalog=Microsoft.eShopOnWeb.Identity;"' 53 | (Get-Content $appsettingsfile).replace($find1, $replace1) | Set-Content $appsettingsfile -Force 54 | 55 | #add exception to ManageController.cs 56 | $ManageControllerfile = 'C:\eshoponweb\eShopOnWeb-master\src\Web\Controllers\ManageController.cs' 57 | $Match = [regex]::Escape("public async Task ChangePassword()") 58 | $NewLine = 'throw new ApplicationException($"Oh no! Error! Error! Yell at Rob! He put this here!");' 59 | $Content = Get-Content $ManageControllerfile -Force 60 | $Index = ($content | Select-String -Pattern $Match).LineNumber + 2 61 | $NewContent = @() 62 | 0..($Content.Count-1) | Foreach-Object { 63 | if ($_ -eq $index) { 64 | $NewContent += $NewLine 65 | } 66 | $NewContent += $Content[$_] 67 | } 68 | $NewContent | Out-File $ManageControllerfile -Force 69 | 70 | #Configure eShoponWeb application 71 | # Run dotnet restore with arguments 72 | $eShopWebDestination = "C:\eshoponweb\eShopOnWeb-master\src\Web" 73 | $proc = (Start-Process -FilePath 'C:\Program Files\dotnet\dotnet.exe' -ArgumentList ('restore') -WorkingDirectory $eShopWebDestination -RedirectStandardOutput "c:\windows\temp\dotnetrestoreoutput.txt" -Passthru) 74 | $proc | Wait-Process 75 | 76 | #Configure CatalogDb 77 | 78 | $proc = (Start-Process -FilePath 'C:\Program Files\dotnet\dotnet.exe' -ArgumentList ('ef','database','update','-c','catalogcontext','-p','../Infrastructure/Infrastructure.csproj','-s','Web.csproj') -WorkingDirectory $eShopWebDestination -RedirectStandardOutput "c:\windows\temp\dotnetefcatoutput.txt" -Passthru) 79 | $proc | Wait-Process 80 | 81 | #Configure Identity Db 82 | $proc = (Start-Process -FilePath 'C:\Program Files\dotnet\dotnet.exe' -ArgumentList ('ef','database','update','-c','appidentitydbcontext','-p','../Infrastructure/Infrastructure.csproj','-s','Web.csproj') -WorkingDirectory $eShopWebDestination -RedirectStandardOutput "c:\windows\temp\dotnetefappoutput.txt" -Passthru) 83 | $proc | Wait-Process 84 | 85 | #Run dotnet build 86 | $proc = (Start-Process -FilePath 'C:\Program Files\dotnet\dotnet.exe' -ArgumentList ('build') -WorkingDirectory $eShopWebDestination -RedirectStandardOutput "c:\windows\temp\dotnetbuildoutput.txt" -Passthru) 87 | $proc | Wait-Process 88 | 89 | # Build Project and publish to a folder 90 | # Share folder to vmadmin and SYSTEM 91 | New-Item -ItemType directory -Path C:\eShopPub 92 | New-SmbShare -Name "eShopPub" -Path "C:\eShopPub" -FullAccess $env:computername"\vmadmin" 93 | Grant-SmbShareAccess -Name "eShopPub" -AccountName SYSTEM -AccessRight Full -Force 94 | Grant-SmbShareAccess -Name "eShopPub" -AccountName Everyone -AccessRight Full -Force 95 | 96 | # Run dotnet publish to to publish files to our share created above 97 | $eShopWebDestination = "C:\eshoponweb\eShopOnWeb-master\src\Web" 98 | $proc = (Start-Process -FilePath 'C:\Program Files\dotnet\dotnet.exe' -ArgumentList ('publish','--output','C:\eShopPub') -WorkingDirectory $eShopWebDestination -Passthru -RedirectStandardOutput "c:\windows\temp\dotnetpuboutput.txt") 99 | $proc | Wait-Process 100 | -------------------------------------------------------------------------------- /Student/Resources/SetupWebServers.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [string]$VSServerName, 3 | [string]$username, 4 | [string]$password 5 | ) 6 | 7 | # Install IIS (with Management Console) 8 | Install-WindowsFeature -name Web-Server -IncludeManagementTools 9 | 10 | # Install ASP.NET 4.6 11 | Install-WindowsFeature Web-Asp-Net45 12 | 13 | # Install Web Management Service (enable and start service) 14 | Install-WindowsFeature -Name Web-Mgmt-Service 15 | Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WebManagement\Server -Name EnableRemoteManagement -Value 1 16 | Set-Service -name WMSVC -StartupType Automatic 17 | if ((Get-Service WMSVC).Status -ne "Running") { 18 | net start wmsvc 19 | } 20 | 21 | # Install Web Deploy 3.6 22 | $msiWebDeployTemp = [System.IO.Path]::GetTempPath().ToString() + "WebDeploy_amd64_en-US.msi" 23 | if (Test-Path $msiWebDeployTemp) { Remove-Item $msiWebDeployTemp -Force } 24 | # Download file from Microsoft Downloads and save to local temp file (%LocalAppData%/Temp/2) 25 | $msiFile = [System.IO.Path]::GetTempFileName() | Rename-Item -NewName { $_ -replace 'tmp$', 'msi' } -PassThru 26 | Invoke-WebRequest -Uri http://download.microsoft.com/download/0/1/D/01DC28EA-638C-4A22-A57B-4CEF97755C6C/WebDeploy_amd64_en-US.msi -OutFile $msiFile 27 | # Prepare a log file name 28 | $logFile = [System.IO.Path]::GetTempFileName() 29 | # Prepare the arguments to execute the MSI 30 | $arguments= '/i ' + $msiFile + ' ADDLOCAL=ALL /qn /norestart LicenseAccepted="0" /lv ' + $logFile 31 | # Sample = msiexec /i C:\Users\{user}\AppData\Local\Temp\2\tmp9267.msi ADDLOCAL=ALL /qn /norestart LicenseAccepted="0" /lv $logFile 32 | # Execute the MSI and wait for it to complete 33 | $proc = (Start-Process -file msiexec -arg $arguments -Passthru) 34 | $proc | Wait-Process 35 | Get-Content $logFile 36 | 37 | # Install Microsoft .Net Core Hosting 2.2.0 38 | $exeDotNetTemp = [System.IO.Path]::GetTempPath().ToString() + "dotnet-hosting-2.2.0-win.exe" 39 | if (Test-Path $exeDotNetTemp) { Remove-Item $exeDotNetTemp -Force } 40 | # Download file from Microsoft Downloads and save to local temp file (%LocalAppData%/Temp/2) 41 | $exeFileNetCore = [System.IO.Path]::GetTempFileName() | Rename-Item -NewName "dotnet-hosting-2.2.0-win.exe" -PassThru 42 | Invoke-WebRequest -Uri "https://download.visualstudio.microsoft.com/download/pr/48adfc75-bce7-4621-ae7a-5f3c4cf4fc1f/9a8e07173697581a6ada4bf04c845a05/dotnet-hosting-2.2.0-win.exe" -OutFile $exeFileNetCore 43 | 44 | # Run the exe with arguments 45 | $proc = (Start-Process -FilePath $exeFileNetCore.Name.ToString() -ArgumentList ('/install','/quiet') -WorkingDirectory $exeFileNetCore.Directory.ToString() -Passthru) 46 | $proc | Wait-Process 47 | 48 | 49 | # Disable Internet Explorer Enhanced Security Configuration 50 | $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" 51 | $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" 52 | Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force 53 | Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force 54 | Stop-Process -Name Explorer -Force 55 | 56 | # Copy eShoponWeb from Published Share and restart IIS 57 | $SharePath = '\\'+$VSServerName+'\eShopPub' 58 | New-SmbMapping -LocalPath v: -RemotePath $SharePath -UserName $username -Password $password >> c:\windows\temp\SetupWebServers.log 59 | Copy-Item "V:\*.*" -Destination "C:\inetpub\wwwroot\" -Recurse -Force >> c:\windows\temp\SetupWebServers.log 60 | Copy-Item "V:\wwwroot\" -Destination C:\inetpub\wwwroot\wwwroot -Recurse -Force >> c:\windows\temp\SetupWebServers.log 61 | 62 | 63 | #Restart iis 64 | Start-Process -FilePath C:\Windows\System32\iisreset.exe -ArgumentList /RESTART >> c:\windows\temp\SetupWebServers.log -------------------------------------------------------------------------------- /Student/Resources/VMSSazuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "envPrefixName": { 6 | "type": "string", 7 | "metadata": { 8 | "description": "Prefix for the environment (2-5 characters)" 9 | }, 10 | "defaultValue": "hack1", 11 | "minLength": 2, 12 | "maxLength": 5 13 | }, 14 | "username": { 15 | "type": "string", 16 | "metadata": { 17 | "description": "VM local administrator username" 18 | } 19 | }, 20 | "password": { 21 | "type": "securestring", 22 | "metadata": { 23 | "description": "VM local administrator password" 24 | } 25 | }, 26 | "webSrvVMSize": { 27 | "type": "string", 28 | "allowedValues": [ 29 | "Standard_DS3_v2" 30 | ], 31 | "metadata": { 32 | "description": "The size of the Web Server VMs Created" 33 | }, 34 | "defaultValue": "Standard_DS3_v2" 35 | }, 36 | "numberOfWebSrvs": { 37 | "type": "int", 38 | "metadata": { 39 | "description": "Number of Web Servers" 40 | }, 41 | "allowedValues": [ 42 | 1, 43 | 2 44 | ], 45 | "defaultValue": 2 46 | }, 47 | "singlePlacementGroup": { 48 | "type": "string", 49 | "metadata": { 50 | "description": "Availability set with five fault domains and five update domains" 51 | }, 52 | "defaultValue": "true" 53 | }, 54 | "priority": { 55 | "type": "string", 56 | "metadata": { 57 | "description": "VM SS Priority" 58 | }, 59 | "defaultValue": "" 60 | }, 61 | "autoscaleDefault": { 62 | "type": "string", 63 | "metadata": { 64 | "description": "Min number of instances" 65 | }, 66 | "defaultValue": "2" 67 | }, 68 | "autoscaleMax": { 69 | "type": "string", 70 | "metadata": { 71 | "description": "Max number of instances" 72 | }, 73 | "defaultValue": "4" 74 | }, 75 | "autoscaleMin": { 76 | "type": "string", 77 | "metadata": { 78 | "description": "Min number of instances" 79 | }, 80 | "defaultValue": "2" 81 | }, 82 | "scaleInCPUPercentageThreshold": { 83 | "type": "string", 84 | "metadata": { 85 | "description": "CPU Threshold for scale in" 86 | }, 87 | "defaultValue": "25" 88 | }, 89 | "scaleInInterval": { 90 | "type": "string", 91 | "metadata": { 92 | "description": "Scale In interval" 93 | }, 94 | "defaultValue": "1" 95 | }, 96 | "scaleOutCPUPercentageThreshold": { 97 | "type": "string", 98 | "metadata": { 99 | "description": "CPU Threshold for scale Out" 100 | }, 101 | "defaultValue": "75" 102 | }, 103 | "scaleOutInterval": { 104 | "type": "string", 105 | "metadata": { 106 | "description": "Scale Out Interval" 107 | }, 108 | "defaultValue": "1" 109 | }, 110 | "sqlVMSize": { 111 | "type": "string", 112 | "allowedValues": [ 113 | "Standard_DS3_v2" 114 | ], 115 | "metadata": { 116 | "description": "The size of the SQL VM Created" 117 | }, 118 | "defaultValue": "Standard_DS3_v2" 119 | }, 120 | "VisualStudioVMSize": { 121 | "type": "string", 122 | "allowedValues": [ 123 | "Standard_DS3_v2" 124 | ], 125 | "metadata": { 126 | "description": "The size of the Visual Studio VM Created" 127 | }, 128 | "defaultValue": "Standard_DS3_v2" 129 | }, 130 | "diskType": { 131 | "type": "string", 132 | "allowedValues": [ 133 | "Standard_LRS", 134 | "Premium_LRS" 135 | ], 136 | "metadata": { 137 | "description": "The type of the Storage Account created" 138 | }, 139 | "defaultValue": "Premium_LRS" 140 | }, 141 | "sqlConnectivityType": { 142 | "type": "string", 143 | "metadata": { 144 | "description": "Server only, Private or Public" 145 | }, 146 | "defaultValue": "Private" 147 | }, 148 | "sqlPortNumber": { 149 | "type": "int", 150 | "metadata": { 151 | "description": "sql server Port Number" 152 | }, 153 | "defaultValue": 1433 154 | }, 155 | "sqlAuthenticationLogin": { 156 | "type": "string", 157 | "metadata": { 158 | "description": "sql server admin username" 159 | }, 160 | "defaultValue": "sqladmin" 161 | }, 162 | "rServicesEnabled": { 163 | "type": "string", 164 | "defaultValue": "false" 165 | }, 166 | "storageAccountType": { 167 | "type": "string", 168 | "defaultValue": "Standard_LRS", 169 | "allowedValues": [ 170 | "Standard_LRS", 171 | "Standard_GRS", 172 | "Standard_ZRS", 173 | "Premium_LRS" 174 | ], 175 | "metadata": { 176 | "description": "Storage Account type" 177 | } 178 | }, 179 | "location": { 180 | "type": "string", 181 | "defaultValue": "[resourceGroup().location]", 182 | "metadata": { 183 | "description": "Location for all resources." 184 | } 185 | } 186 | }, 187 | "variables": { 188 | "virtualNetworkName": "[concat(parameters('envPrefixName'), 'Vnet')]", 189 | "resourceId": "[resourceGroup().id]", 190 | "addressPrefix": "10.0.0.0/16", 191 | "feSubnetPrefix": "10.0.0.0/24", 192 | "dbSubnetPrefix": "10.0.2.0/24", 193 | "feNSGName": "feNsg", 194 | "dbNSGName": "dbNsg", 195 | "sqlSrvDBName": "[concat(parameters('envPrefixName'), 'sqlSrv16')]", 196 | "sqlVmSize": "[parameters('sqlVMSize')]", 197 | "sqlSrvDBNicName": "[concat(variables('sqlSrvDBName'), 'Nic')]", 198 | "sqlSvrDBSubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), 'DBSubnetName')]", 199 | "sqlPublicIP": "[concat(parameters('envPrefixName'), 'SqlPip')]", 200 | "sqlPublicIPRef": "[resourceId('Microsoft.Network/publicIPAddresses', variables('sqlPublicIP'))]", 201 | "sqlImagePublisher": "MicrosoftSQLServer", 202 | "sqlImageOffer": "SQL2016SP1-WS2016", 203 | "sqlImageSku": "Standard", 204 | "VisualStudioSrvName": "[concat(parameters('envPrefixName'), 'VSSrv17')]", 205 | "VisualStudioVmSize": "[parameters('VisualStudioVMSize')]", 206 | "VisualStudioNicName": "[concat(variables('VisualStudioSrvName'), 'Nic')]", 207 | "VisualStudioSubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), 'FESubnetName')]", 208 | "VisualStudioPublicIP": "[concat(parameters('envPrefixName'), 'VSPip')]", 209 | "VisualStudioPublicIPRef": "[resourceId('Microsoft.Network/publicIPAddresses', variables('VisualStudioPublicIP'))]", 210 | "VisualStudioImagePublisher": "MicrosoftVisualStudio", 211 | "VisualStudioImageOffer": "VisualStudio", 212 | "VisualStudioImageSku": "VS-2017-Comm-Latest-WS2016", 213 | "vmssName": "[concat(parameters('envPrefixName'), 'webScaleSet')]", 214 | "vmssId": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', variables('vmssName'))]", 215 | "vmssFirstServerIP": "[concat('Microsoft.Compute/virtualMachineScaleSets/', variables('vmssName'), '/virtualMachines/0/networkInterfaces/', variables('vmssName') ,'Nic')]", 216 | "storageAccountid": "[concat(variables('resourceId'),'/providers/Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", 217 | "webSrvSubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), 'FESubnetName')]", 218 | "webSrvPublicIP": "[concat(parameters('envPrefixName'), 'webscalesetpip')]", 219 | "webSrvDnsNameforLBIP": "[concat(toLower(variables('vmssName')), 'lb')]", 220 | "webLbName": "[concat(variables('vmssName'), 'lb')]", 221 | "webLblb_PIP_Id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('webSrvPublicIP'))]", 222 | "webLbId": "[resourceId('Microsoft.Network/loadBalancers',variables('webLbName'))]", 223 | "namingInfix": "[toLower(substring(concat(variables('vmssName'), uniqueString(resourceGroup().id)), 0, 9))]", 224 | "networkApiVersion": "2018-01-01", 225 | "autoscaleApiVersion": "2015-04-01", 226 | "frontEndIPConfigID": "[concat(variables('webLbId'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]", 227 | "lbPoolID": "[concat(variables('webLbId'),'/backendAddressPools/BackendPool1')]", 228 | "lbProbeID": "[concat(variables('webLbId'),'/probes/tcpProbe')]", 229 | "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'mondiagact')]", 230 | "accountid": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" 231 | }, 232 | "resources": [ 233 | { 234 | "type": "Microsoft.Storage/storageAccounts", 235 | "name": "[variables('storageAccountName')]", 236 | "apiVersion": "2016-01-01", 237 | "location": "[parameters('location')]", 238 | "sku": { 239 | "name": "[parameters('storageAccountType')]" 240 | }, 241 | "kind": "Storage", 242 | "properties": {} 243 | }, 244 | { 245 | "apiVersion": "2015-06-15", 246 | "type": "Microsoft.Network/networkSecurityGroups", 247 | "name": "[variables('feNSGName')]", 248 | "location": "[parameters('location')]", 249 | "tags": { 250 | "displayName": "FrontEndNSG" 251 | }, 252 | "properties": { 253 | "securityRules": [ 254 | { 255 | "name": "rdp_rule", 256 | "properties": { 257 | "description": "Allow RDP", 258 | "protocol": "Tcp", 259 | "sourcePortRange": "*", 260 | "destinationPortRange": "3389", 261 | "sourceAddressPrefix": "Internet", 262 | "destinationAddressPrefix": "*", 263 | "access": "Allow", 264 | "priority": 100, 265 | "direction": "Inbound" 266 | } 267 | }, 268 | { 269 | "name": "web_rule", 270 | "properties": { 271 | "description": "Allow WEB", 272 | "protocol": "Tcp", 273 | "sourcePortRange": "*", 274 | "destinationPortRange": "80", 275 | "sourceAddressPrefix": "Internet", 276 | "destinationAddressPrefix": "*", 277 | "access": "Allow", 278 | "priority": 101, 279 | "direction": "Inbound" 280 | } 281 | }, 282 | { 283 | "name": "publish_rule", 284 | "properties": { 285 | "description": "Allow Web Publish", 286 | "protocol": "Tcp", 287 | "sourcePortRange": "*", 288 | "destinationPortRange": "8172", 289 | "sourceAddressPrefix": "Internet", 290 | "destinationAddressPrefix": "*", 291 | "access": "Allow", 292 | "priority": 102, 293 | "direction": "Inbound" 294 | } 295 | } 296 | ] 297 | } 298 | }, 299 | { 300 | "type": "Microsoft.Network/networkSecurityGroups", 301 | "apiVersion": "2015-06-15", 302 | "name": "[variables('dbNSGName')]", 303 | "location": "[parameters('location')]", 304 | "tags": { 305 | "displayName": "BackEndNSG" 306 | }, 307 | "properties": { 308 | "securityRules": [ 309 | { 310 | "name": "Allow_FE", 311 | "properties": { 312 | "description": "Allow FE Subnet", 313 | "protocol": "Tcp", 314 | "sourcePortRange": "*", 315 | "destinationPortRange": "1433", 316 | "sourceAddressPrefix": "10.0.0.0/24", 317 | "destinationAddressPrefix": "*", 318 | "access": "Allow", 319 | "priority": 100, 320 | "direction": "Inbound" 321 | } 322 | }, 323 | { 324 | "name": "rdp_rule", 325 | "properties": { 326 | "description": "Allow RDP", 327 | "protocol": "Tcp", 328 | "sourcePortRange": "*", 329 | "destinationPortRange": "3389", 330 | "sourceAddressPrefix": "Internet", 331 | "destinationAddressPrefix": "*", 332 | "access": "Allow", 333 | "priority": 110, 334 | "direction": "Inbound" 335 | } 336 | }, 337 | { 338 | "name": "Block_FE", 339 | "properties": { 340 | "description": "Block App Subnet", 341 | "protocol": "*", 342 | "sourcePortRange": "*", 343 | "destinationPortRange": "*", 344 | "sourceAddressPrefix": "10.0.0.0/24", 345 | "destinationAddressPrefix": "*", 346 | "access": "Deny", 347 | "priority": 121, 348 | "direction": "Inbound" 349 | } 350 | } 351 | ] 352 | } 353 | }, 354 | { 355 | "apiVersion": "2015-06-15", 356 | "type": "Microsoft.Network/virtualNetworks", 357 | "name": "[variables('virtualNetworkName')]", 358 | "location": "[parameters('location')]", 359 | "dependsOn": [ 360 | "[concat('Microsoft.Network/networkSecurityGroups/', variables('feNSGName'))]", 361 | "[concat('Microsoft.Network/networkSecurityGroups/', variables('dbNSGName'))]" 362 | ], 363 | "tags": { 364 | "displayName": "VirtualNetwork" 365 | }, 366 | "properties": { 367 | "addressSpace": { 368 | "addressPrefixes": [ 369 | "[variables('addressPrefix')]" 370 | ] 371 | }, 372 | "subnets": [ 373 | { 374 | "name": "FESubnetName", 375 | "properties": { 376 | "addressPrefix": "[variables('feSubnetPrefix')]", 377 | "networkSecurityGroup": { 378 | "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('feNSGName'))]" 379 | } 380 | } 381 | }, 382 | { 383 | "name": "DBSubnetName", 384 | "properties": { 385 | "addressPrefix": "[variables('dbSubnetPrefix')]", 386 | "networkSecurityGroup": { 387 | "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('dbNSGName'))]" 388 | } 389 | } 390 | } 391 | ] 392 | } 393 | }, 394 | { 395 | "name": "[variables('sqlPublicIP')]", 396 | "type": "Microsoft.Network/publicIPAddresses", 397 | "location": "[parameters('location')]", 398 | "apiVersion": "2015-06-15", 399 | "tags": { 400 | "displayName": "SqlPIP" 401 | }, 402 | "properties": { 403 | "publicIPAllocationMethod": "Dynamic", 404 | "idleTimeoutInMinutes": 4 405 | } 406 | }, 407 | { 408 | "name": "[variables('sqlSrvDBNicName')]", 409 | "type": "Microsoft.Network/networkInterfaces", 410 | "location": "[parameters('location')]", 411 | "apiVersion": "2015-06-15", 412 | "dependsOn": [ 413 | "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" 414 | ], 415 | "tags": { 416 | "displayName": "SQLSrvDBNic" 417 | }, 418 | "properties": { 419 | "ipConfigurations": [ 420 | { 421 | "name": "ipconfig1", 422 | "properties": { 423 | "privateIPAllocationMethod": "Dynamic", 424 | "subnet": { 425 | "id": "[variables('sqlSvrDBSubnetRef')]" 426 | }, 427 | "publicIPAddress": { 428 | "id": "[variables('sqlPublicIPRef')]" 429 | } 430 | } 431 | } 432 | ] 433 | } 434 | }, 435 | { 436 | "name": "[concat(parameters('envPrefixName'), 'sqlSrv16')]", 437 | "type": "Microsoft.Compute/virtualMachines", 438 | "location": "[parameters('location')]", 439 | "apiVersion": "2017-03-30", 440 | "identity": { 441 | "type": "SystemAssigned" 442 | }, 443 | "dependsOn": [ 444 | "[concat('Microsoft.Network/networkInterfaces/', variables('sqlSrvDBNicName'))]", 445 | "[concat('Microsoft.Network/publicIPAddresses/', variables('sqlPublicIP'))]" 446 | ], 447 | "tags": { 448 | "displayName": "SQL-Svr-DB" 449 | }, 450 | "properties": { 451 | "hardwareProfile": { 452 | "vmSize": "[variables('sqlVmSize')]" 453 | }, 454 | "osProfile": { 455 | "computerName": "[variables('sqlSrvDBName')]", 456 | "adminUsername": "[parameters('username')]", 457 | "adminPassword": "[parameters('password')]" 458 | }, 459 | "storageProfile": { 460 | "imageReference": { 461 | "publisher": "[variables('sqlImagePublisher')]", 462 | "offer": "[variables('sqlImageOffer')]", 463 | "sku": "[variables('sqlImageSku')]", 464 | "version": "latest" 465 | }, 466 | "osDisk": { 467 | "name": "[concat(variables('sqlSrvDBName'),'_OSDisk')]", 468 | "caching": "ReadWrite", 469 | "createOption": "FromImage", 470 | "managedDisk": { 471 | "storageAccountType": "[parameters('diskType')]" 472 | } 473 | } 474 | }, 475 | "networkProfile": { 476 | "networkInterfaces": [ 477 | { 478 | "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('sqlSrvDBNicName'))]" 479 | } 480 | ] 481 | } 482 | }, 483 | "resources": [] 484 | }, 485 | { 486 | "type": "Microsoft.Compute/virtualMachines/extensions", 487 | "name": "[concat(parameters('envPrefixName'), 'sqlSrv16/WADExtensionSetup')]", 488 | "apiVersion": "2015-06-15", 489 | "location": "[resourceGroup().location]", 490 | "dependsOn": [ 491 | "[concat('Microsoft.Compute/virtualMachines/', parameters('envPrefixName'), 'sqlSrv16')]", 492 | "[resourceId('Microsoft.Compute/virtualMachines/extensions', concat(parameters('envPrefixName'), 'sqlSrv16'),'SqlIaasExtension')]" 493 | ], 494 | "properties": { 495 | "publisher": "Microsoft.ManagedIdentity", 496 | "type": "ManagedIdentityExtensionForWindows", 497 | "typeHandlerVersion": "1.0", 498 | "autoUpgradeMinorVersion": true, 499 | "settings": { 500 | "port": 50342 501 | } 502 | } 503 | }, 504 | { 505 | "type": "Microsoft.Compute/virtualMachines/extensions", 506 | "name": "[concat(parameters('envPrefixName'), 'sqlSrv16/VMDiagnosticsSettings')]", 507 | "apiVersion": "2015-06-15", 508 | "location": "[resourceGroup().location]", 509 | "dependsOn": [ 510 | "[concat('Microsoft.Compute/virtualMachines/', parameters('envPrefixName'), 'sqlSrv16')]", 511 | "[resourceId('Microsoft.Compute/virtualMachines/extensions', concat(parameters('envPrefixName'), 'sqlSrv16'),'SqlIaasExtension')]", 512 | "[resourceId('Microsoft.Compute/virtualMachines/extensions', concat(parameters('envPrefixName'), 'sqlSrv16'),'WADExtensionSetup')]" 513 | ], 514 | "properties": { 515 | "publisher": "Microsoft.Azure.Diagnostics", 516 | "type": "IaaSDiagnostics", 517 | "typeHandlerVersion": "1.5", 518 | "autoUpgradeMinorVersion": true, 519 | "settings": { 520 | "WadCfg": { 521 | "DiagnosticMonitorConfiguration": { 522 | "overallQuotaInMB": 4096, 523 | "DiagnosticInfrastructureLogs": { 524 | "scheduledTransferLogLevelFilter": "Error" 525 | }, 526 | "Directories": { 527 | "scheduledTransferPeriod": "PT1M", 528 | "IISLogs": { 529 | "containerName": "wad-iis-logfiles" 530 | }, 531 | "FailedRequestLogs": { 532 | "containerName": "wad-failedrequestlogs" 533 | } 534 | }, 535 | "PerformanceCounters": { 536 | "scheduledTransferPeriod": "PT1M", 537 | "sinks": "AzMonSink", 538 | "PerformanceCounterConfiguration": [ 539 | { 540 | "counterSpecifier": "\\Memory\\Available Bytes", 541 | "sampleRate": "PT15S" 542 | }, 543 | { 544 | "counterSpecifier": "\\Memory\\% Committed Bytes In Use", 545 | "sampleRate": "PT15S" 546 | }, 547 | { 548 | "counterSpecifier": "\\Memory\\Committed Bytes", 549 | "sampleRate": "PT15S" 550 | } 551 | ] 552 | }, 553 | "WindowsEventLog": { 554 | "scheduledTransferPeriod": "PT1M", 555 | "DataSource": [ 556 | { 557 | "name": "Application!*" 558 | } 559 | ] 560 | }, 561 | "Logs": { 562 | "scheduledTransferPeriod": "PT1M", 563 | "scheduledTransferLogLevelFilter": "Error" 564 | } 565 | }, 566 | "SinksConfig": { 567 | "Sink": [ 568 | { 569 | "name": "AzMonSink", 570 | "AzureMonitor": {} 571 | } 572 | ] 573 | } 574 | }, 575 | "StorageAccount": "[variables('storageAccountName')]" 576 | }, 577 | "protectedSettings": { 578 | "storageAccountName": "[variables('storageAccountName')]", 579 | "storageAccountKey": "[listKeys(variables('accountid'),'2015-06-15').key1]", 580 | "storageAccountEndPoint": "https://core.windows.net/" 581 | } 582 | } 583 | }, 584 | { 585 | "apiVersion": "2015-06-15", 586 | "type": "Microsoft.Compute/virtualMachines/extensions", 587 | "name": "[concat(parameters('envPrefixName'), 'sqlSrv16/SqlIaasExtension')]", 588 | "location": "[parameters('location')]", 589 | "dependsOn": [ 590 | "[concat('Microsoft.Compute/virtualMachines/', parameters('envPrefixName'), 'sqlSrv16')]" 591 | ], 592 | "properties": { 593 | "type": "SqlIaaSAgent", 594 | "publisher": "Microsoft.SqlServer.Management", 595 | "typeHandlerVersion": "1.2", 596 | "autoUpgradeMinorVersion": "true", 597 | "settings": { 598 | "AutoTelemetrySettings": { 599 | "Region": "[parameters('location')]" 600 | }, 601 | "AutoPatchingSettings": { 602 | "PatchCategory": "WindowsMandatoryUpdates", 603 | "Enable": false 604 | }, 605 | "KeyVaultCredentialSettings": { 606 | "Enable": false, 607 | "CredentialName": "" 608 | }, 609 | "ServerConfigurationsManagementSettings": { 610 | "SQLConnectivityUpdateSettings": { 611 | "ConnectivityType": "[parameters('sqlConnectivityType')]", 612 | "Port": "[parameters('sqlPortNumber')]" 613 | }, 614 | "AdditionalFeaturesServerConfigurations": { 615 | "IsRServicesEnabled": "[parameters('rServicesEnabled')]" 616 | } 617 | } 618 | }, 619 | "protectedSettings": { 620 | "SQLAuthUpdateUserName": "[parameters('sqlAuthenticationLogin')]", 621 | "SQLAuthUpdatePassword": "[parameters('password')]" 622 | } 623 | } 624 | }, 625 | { 626 | "name": "[variables('VisualStudioPublicIP')]", 627 | "type": "Microsoft.Network/publicIPAddresses", 628 | "location": "[parameters('location')]", 629 | "apiVersion": "2015-06-15", 630 | "tags": { 631 | "displayName": "VSPIP" 632 | }, 633 | "properties": { 634 | "publicIPAllocationMethod": "Dynamic", 635 | "idleTimeoutInMinutes": 4 636 | } 637 | }, 638 | { 639 | "name": "[variables('VisualStudioNicName')]", 640 | "type": "Microsoft.Network/networkInterfaces", 641 | "location": "[parameters('location')]", 642 | "apiVersion": "2015-06-15", 643 | "dependsOn": [ 644 | "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" 645 | ], 646 | "tags": { 647 | "displayName": "VSNic" 648 | }, 649 | "properties": { 650 | "ipConfigurations": [ 651 | { 652 | "name": "ipconfig1", 653 | "properties": { 654 | "privateIPAllocationMethod": "Dynamic", 655 | "subnet": { 656 | "id": "[variables('VisualStudioSubnetRef')]" 657 | }, 658 | "publicIPAddress": { 659 | "id": "[variables('VisualStudioPublicIPRef')]" 660 | } 661 | } 662 | } 663 | ] 664 | } 665 | }, 666 | { 667 | "name": "[concat(parameters('envPrefixName'), 'VSSrv17')]", 668 | "type": "Microsoft.Compute/virtualMachines", 669 | "location": "[parameters('location')]", 670 | "apiVersion": "2017-03-30", 671 | "dependsOn": [ 672 | "[concat('Microsoft.Network/networkInterfaces/', variables('VisualStudioNicName'))]", 673 | "[concat('Microsoft.Network/publicIPAddresses/', variables('VisualStudioPublicIP'))]", 674 | "[concat('Microsoft.Compute/virtualMachines/', parameters('envPrefixName'), 'sqlSrv16')]", 675 | "[resourceId('Microsoft.Compute/virtualMachines/extensions/', variables('sqlSrvDBName'), 'SqlIaasExtension')]" 676 | ], 677 | "tags": { 678 | "displayName": "VSSrv" 679 | }, 680 | "properties": { 681 | "hardwareProfile": { 682 | "vmSize": "[variables('VisualStudioVmSize')]" 683 | }, 684 | "osProfile": { 685 | "computerName": "[variables('VisualStudioSrvName')]", 686 | "adminUsername": "[parameters('username')]", 687 | "adminPassword": "[parameters('password')]" 688 | }, 689 | "storageProfile": { 690 | "imageReference": { 691 | "publisher": "[variables('VisualStudioImagePublisher')]", 692 | "offer": "[variables('VisualStudioImageOffer')]", 693 | "sku": "[variables('VisualStudioImageSku')]", 694 | "version": "latest" 695 | }, 696 | "osDisk": { 697 | "name": "[concat(variables('VisualStudioSrvName'),'_OSDisk')]", 698 | "caching": "ReadWrite", 699 | "createOption": "FromImage", 700 | "managedDisk": { 701 | "storageAccountType": "[parameters('diskType')]" 702 | } 703 | } 704 | }, 705 | "networkProfile": { 706 | "networkInterfaces": [ 707 | { 708 | "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('VisualStudioNicName'))]" 709 | } 710 | ] 711 | } 712 | }, 713 | "resources": [ 714 | { 715 | "type": "extensions", 716 | "name": "[concat(parameters('envPrefixName'), 'VSSrv17CustomScriptExtension')]", 717 | "apiVersion": "2017-03-30", 718 | "location": "[resourceGroup().location]", 719 | "dependsOn": [ 720 | "[concat(parameters('envPrefixName'), 'VSSrv17')]" 721 | ], 722 | "properties": { 723 | "publisher": "Microsoft.Compute", 724 | "type": "CustomScriptExtension", 725 | "typeHandlerVersion": "1.9", 726 | "autoUpgradeMinorVersion": true, 727 | "forceUpdateTag": "1.0.0", 728 | "settings": { 729 | "fileUris": [ 730 | "https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/master/Student/Resources/SetupVSServer.ps1" 731 | ], 732 | "commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File SetupVSServer.ps1 ', ' ', variables('sqlSrvDBName'), ' ', parameters('password'))]" 733 | } 734 | } 735 | } 736 | ] 737 | }, 738 | { 739 | "name": "[variables('webSrvPublicIP')]", 740 | "type": "Microsoft.Network/publicIPAddresses", 741 | "location": "[parameters('location')]", 742 | "apiVersion": "2015-06-15", 743 | "tags": { 744 | "displayName": "WebSrvPIP for LB" 745 | }, 746 | "properties": { 747 | "publicIPAllocationMethod": "Dynamic", 748 | "idleTimeoutInMinutes": 4, 749 | "dnsSettings": { 750 | "domainNameLabel": "[variables('webSrvDnsNameforLBIP')]" 751 | } 752 | } 753 | }, 754 | { 755 | "apiVersion": "2015-06-15", 756 | "name": "[variables('webLbName')]", 757 | "type": "Microsoft.Network/loadBalancers", 758 | "location": "[parameters('location')]", 759 | "tags": { 760 | "displayName": "Web LB" 761 | }, 762 | "dependsOn": [ 763 | "[concat('Microsoft.Network/publicIPAddresses/', variables('webSrvPublicIP'))]" 764 | ], 765 | "properties": { 766 | "frontendIPConfigurations": [ 767 | { 768 | "name": "LoadBalancerFrontEnd", 769 | "properties": { 770 | "publicIPAddress": { 771 | "id": "[variables('webLblb_PIP_Id')]" 772 | } 773 | } 774 | } 775 | ], 776 | "backendAddressPools": [ 777 | { 778 | "name": "BackendPool1" 779 | } 780 | ], 781 | "inboundNatPools": [ 782 | { 783 | "name": "natpool", 784 | "properties": { 785 | "frontendIPConfiguration": { 786 | "id": "[concat(variables('webLbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]" 787 | }, 788 | "protocol": "Tcp", 789 | "frontendPortRangeStart": 50000, 790 | "frontendPortRangeEnd": 50119, 791 | "backendPort": 3389 792 | } 793 | } 794 | ], 795 | "probes": [ 796 | { 797 | "name": "tcpProbe", 798 | "properties": { 799 | "protocol": "Tcp", 800 | "port": 80, 801 | "intervalInSeconds": 5, 802 | "numberOfProbes": 2 803 | } 804 | } 805 | ], 806 | "loadBalancingRules": [ 807 | { 808 | "name": "LBRule", 809 | "properties": { 810 | "frontendIPConfiguration": { 811 | "id": "[variables('frontEndIPConfigID')]" 812 | }, 813 | "backendAddressPool": { 814 | "id": "[variables('lbPoolID')]" 815 | }, 816 | "protocol": "Tcp", 817 | "frontendPort": 80, 818 | "backendPort": 80, 819 | "enableFloatingIP": false, 820 | "idleTimeoutInMinutes": 5, 821 | "probe": { 822 | "id": "[variables('lbProbeID')]" 823 | } 824 | } 825 | } 826 | ] 827 | } 828 | }, 829 | { 830 | "name": "[variables('vmssName')]", 831 | "type": "Microsoft.Compute/virtualMachineScaleSets", 832 | "apiVersion": "2017-03-30", 833 | "location": "[parameters('location')]", 834 | "identity": { 835 | "type": "systemAssigned" 836 | }, 837 | "dependsOn": [ 838 | "[concat('Microsoft.Network/loadBalancers/', variables('webLbName'))]", 839 | "[concat('Microsoft.Compute/virtualMachines/', variables('VisualStudioSrvName'))]", 840 | "[concat(parameters('envPrefixName'), 'VSSrv17CustomScriptExtension')]" 841 | ], 842 | "sku": { 843 | "name": "[parameters('webSrvVMSize')]", 844 | "tier": "Standard", 845 | "capacity": "[int(parameters('numberOfWebSrvs'))]" 846 | }, 847 | "properties": { 848 | "overprovision": false, 849 | "upgradePolicy": { 850 | "mode": "Manual" 851 | }, 852 | "singlePlacementGroup": "[parameters('singlePlacementGroup')]", 853 | "virtualMachineProfile": { 854 | "storageProfile": { 855 | "imageReference": { 856 | "publisher": "MicrosoftWindowsServer", 857 | "offer": "WindowsServer", 858 | "sku": "2016-Datacenter", 859 | "version": "latest" 860 | }, 861 | "osDisk": { 862 | "createOption": "FromImage", 863 | "caching": "ReadWrite" 864 | } 865 | }, 866 | "priority": "[parameters('priority')]", 867 | "osProfile": { 868 | "computerNamePrefix": "[variables('namingInfix')]", 869 | "adminUsername": "[parameters('username')]", 870 | "adminPassword": "[parameters('password')]" 871 | }, 872 | "networkProfile": { 873 | "networkInterfaceConfigurations": [ 874 | { 875 | "name": "[concat(variables('vmssName'), 'Nic')]", 876 | "properties": { 877 | "primary": true, 878 | "ipConfigurations": [ 879 | { 880 | "name": "[concat(variables('vmssName'), 'IpConfig')]", 881 | "properties": { 882 | "subnet": { 883 | "id": "[variables('webSrvSubnetRef')]" 884 | }, 885 | "loadBalancerBackendAddressPools": [ 886 | { 887 | "id": "[reference(variables('webLbId'), variables('networkApiVersion')).backendAddressPools[0].id]" 888 | } 889 | ], 890 | "loadBalancerInboundNatPools": [ 891 | { 892 | "id": "[reference(variables('webLbId'), variables('networkApiVersion')).inboundNatPools[0].id]" 893 | } 894 | ] 895 | } 896 | } 897 | ] 898 | } 899 | } 900 | ] 901 | }, 902 | "extensionProfile": { 903 | "extensions": [ 904 | { 905 | "name": "CustomScriptExtension", 906 | "properties": { 907 | "publisher": "Microsoft.Compute", 908 | "type": "CustomScriptExtension", 909 | "typeHandlerVersion": "1.9", 910 | "autoUpgradeMinorVersion": true, 911 | "settings": { 912 | "fileUris": [ 913 | "https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/master/Student/Resources/SetupWebServers.ps1" 914 | ], 915 | "commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File SetupWebServers.ps1 ',variables('VisualStudioSrvName'), ' ', parameters('username'), ' ', parameters('password'))]" 916 | } 917 | } 918 | }, 919 | { 920 | "name": "VMSSWADextension", 921 | "properties": { 922 | "publisher": "Microsoft.ManagedIdentity", 923 | "type": "ManagedIdentityExtensionForWindows", 924 | "typeHandlerVersion": "1.0", 925 | "autoUpgradeMinorVersion": true, 926 | "settings": { 927 | "port": 50342 928 | }, 929 | "protectedSettings": {} 930 | } 931 | }, 932 | { 933 | "name": "IaaSDiagnostics", 934 | "properties": { 935 | "publisher": "Microsoft.Azure.Diagnostics", 936 | "type": "IaaSDiagnostics", 937 | "typeHandlerVersion": "1.5", 938 | "autoUpgradeMinorVersion": true, 939 | "settings": { 940 | "StorageAccount": "[variables('storageAccountName')]", 941 | "WadCfg": { 942 | "DiagnosticMonitorConfiguration": { 943 | "overallQuotaInMB": 50000, 944 | "Metrics": { 945 | "resourceId": "[concat('/subscriptions/',subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachineScaleSets/', variables('namingInfix'))]", 946 | "MetricAggregation": [ 947 | { 948 | "scheduledTransferPeriod": "PT1H" 949 | }, 950 | { 951 | "scheduledTransferPeriod": "PT1M" 952 | } 953 | ] 954 | }, 955 | "DiagnosticInfrastructureLogs": { 956 | "scheduledTransferLogLevelFilter": "Error" 957 | }, 958 | "PerformanceCounters": { 959 | "scheduledTransferPeriod": "PT1M", 960 | "sinks": "AzMonSink", 961 | "PerformanceCounterConfiguration": [ 962 | { 963 | "counterSpecifier": "\\Processor Information(_Total)\\% Processor Time", 964 | "sampleRate": "PT1M" 965 | }, 966 | { 967 | "counterSpecifier": "\\Processor Information(_Total)\\% Privileged Time", 968 | "sampleRate": "PT1M" 969 | }, 970 | { 971 | "counterSpecifier": "\\Processor Information(_Total)\\% User Time", 972 | "sampleRate": "PT1M" 973 | }, 974 | { 975 | "counterSpecifier": "\\Processor Information(_Total)\\Processor Frequency", 976 | "sampleRate": "PT1M" 977 | }, 978 | { 979 | "counterSpecifier": "\\System\\Processes", 980 | "sampleRate": "PT1M" 981 | }, 982 | { 983 | "counterSpecifier": "\\Process(_Total)\\Thread Count", 984 | "sampleRate": "PT1M" 985 | }, 986 | { 987 | "counterSpecifier": "\\Process(_Total)\\Handle Count", 988 | "sampleRate": "PT1M" 989 | }, 990 | { 991 | "counterSpecifier": "\\System\\System Up Time", 992 | "sampleRate": "PT1M" 993 | }, 994 | { 995 | "counterSpecifier": "\\System\\Context Switches/sec", 996 | "sampleRate": "PT1M" 997 | }, 998 | { 999 | "counterSpecifier": "\\System\\Processor Queue Length", 1000 | "sampleRate": "PT1M" 1001 | }, 1002 | { 1003 | "counterSpecifier": "\\Memory\\% Committed Bytes In Use", 1004 | "sampleRate": "PT1M" 1005 | }, 1006 | { 1007 | "counterSpecifier": "\\Memory\\Available Bytes", 1008 | "sampleRate": "PT1M" 1009 | }, 1010 | { 1011 | "counterSpecifier": "\\Memory\\Committed Bytes", 1012 | "sampleRate": "PT1M" 1013 | }, 1014 | { 1015 | "counterSpecifier": "\\Memory\\Cache Bytes", 1016 | "sampleRate": "PT1M" 1017 | }, 1018 | { 1019 | "counterSpecifier": "\\Memory\\Pool Paged Bytes", 1020 | "sampleRate": "PT1M" 1021 | }, 1022 | { 1023 | "counterSpecifier": "\\Memory\\Pool Nonpaged Bytes", 1024 | "sampleRate": "PT1M" 1025 | }, 1026 | { 1027 | "counterSpecifier": "\\Memory\\Pages/sec", 1028 | "sampleRate": "PT1M" 1029 | }, 1030 | { 1031 | "counterSpecifier": "\\Memory\\Page Faults/sec", 1032 | "sampleRate": "PT1M" 1033 | }, 1034 | { 1035 | "counterSpecifier": "\\Process(_Total)\\Working Set", 1036 | "sampleRate": "PT1M" 1037 | }, 1038 | { 1039 | "counterSpecifier": "\\Process(_Total)\\Working Set - Private", 1040 | "sampleRate": "PT1M" 1041 | }, 1042 | { 1043 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Time", 1044 | "sampleRate": "PT1M" 1045 | }, 1046 | { 1047 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Read Time", 1048 | "sampleRate": "PT1M" 1049 | }, 1050 | { 1051 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Disk Write Time", 1052 | "sampleRate": "PT1M" 1053 | }, 1054 | { 1055 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Idle Time", 1056 | "sampleRate": "PT1M" 1057 | }, 1058 | { 1059 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Bytes/sec", 1060 | "sampleRate": "PT1M" 1061 | }, 1062 | { 1063 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Read Bytes/sec", 1064 | "sampleRate": "PT1M" 1065 | }, 1066 | { 1067 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Write Bytes/sec", 1068 | "sampleRate": "PT1M" 1069 | }, 1070 | { 1071 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Transfers/sec", 1072 | "sampleRate": "PT1M" 1073 | }, 1074 | { 1075 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Reads/sec", 1076 | "sampleRate": "PT1M" 1077 | }, 1078 | { 1079 | "counterSpecifier": "\\LogicalDisk(_Total)\\Disk Writes/sec", 1080 | "sampleRate": "PT1M" 1081 | }, 1082 | { 1083 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Transfer", 1084 | "sampleRate": "PT1M" 1085 | }, 1086 | { 1087 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Read", 1088 | "sampleRate": "PT1M" 1089 | }, 1090 | { 1091 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk sec/Write", 1092 | "sampleRate": "PT1M" 1093 | }, 1094 | { 1095 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Queue Length", 1096 | "sampleRate": "PT1M" 1097 | }, 1098 | { 1099 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Read Queue Length", 1100 | "sampleRate": "PT1M" 1101 | }, 1102 | { 1103 | "counterSpecifier": "\\LogicalDisk(_Total)\\Avg. Disk Write Queue Length", 1104 | "sampleRate": "PT1M" 1105 | }, 1106 | { 1107 | "counterSpecifier": "\\LogicalDisk(_Total)\\% Free Space", 1108 | "sampleRate": "PT1M" 1109 | }, 1110 | { 1111 | "counterSpecifier": "\\LogicalDisk(_Total)\\Free Megabytes", 1112 | "sampleRate": "PT1M" 1113 | }, 1114 | { 1115 | "counterSpecifier": "\\Network Interface(*)\\Bytes Total/sec", 1116 | "sampleRate": "PT1M" 1117 | }, 1118 | { 1119 | "counterSpecifier": "\\Network Interface(*)\\Bytes Sent/sec", 1120 | "sampleRate": "PT1M" 1121 | }, 1122 | { 1123 | "counterSpecifier": "\\Network Interface(*)\\Bytes Received/sec", 1124 | "sampleRate": "PT1M" 1125 | }, 1126 | { 1127 | "counterSpecifier": "\\Network Interface(*)\\Packets/sec", 1128 | "sampleRate": "PT1M" 1129 | }, 1130 | { 1131 | "counterSpecifier": "\\Network Interface(*)\\Packets Sent/sec", 1132 | "sampleRate": "PT1M" 1133 | }, 1134 | { 1135 | "counterSpecifier": "\\Network Interface(*)\\Packets Received/sec", 1136 | "sampleRate": "PT1M" 1137 | }, 1138 | { 1139 | "counterSpecifier": "\\Network Interface(*)\\Packets Outbound Errors", 1140 | "sampleRate": "PT1M" 1141 | }, 1142 | { 1143 | "counterSpecifier": "\\Network Interface(*)\\Packets Received Errors", 1144 | "sampleRate": "PT1M" 1145 | } 1146 | ] 1147 | }, 1148 | "WindowsEventLog": { 1149 | "scheduledTransferPeriod": "PT1M", 1150 | "DataSource": [ 1151 | { 1152 | "name": "Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]" 1153 | }, 1154 | { 1155 | "name": "Security!*[System[band(Keywords,4503599627370496)]]" 1156 | }, 1157 | { 1158 | "name": "System!*[System[(Level = 1 or Level = 2 or Level = 3)]]" 1159 | } 1160 | ] 1161 | } 1162 | }, 1163 | "SinksConfig": { 1164 | "Sink": [ 1165 | { 1166 | "name": "AzMonSink", 1167 | "AzureMonitor": {} 1168 | } 1169 | ] 1170 | } 1171 | } 1172 | }, 1173 | "protectedSettings": { 1174 | "storageAccountName": "[variables('storageAccountName')]", 1175 | "storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')),'2015-05-01-preview').key1]", 1176 | "storageAccountEndPoint": "https://core.windows.net/" 1177 | } 1178 | } 1179 | } 1180 | ] 1181 | } 1182 | } 1183 | } 1184 | }, 1185 | { 1186 | "type": "Microsoft.Insights/autoscaleSettings", 1187 | "apiVersion": "[variables('autoscaleApiVersion')]", 1188 | "name": "[concat('cpuautoscale', variables('namingInfix'))]", 1189 | "location": "[parameters('location')]", 1190 | "dependsOn": [ 1191 | "[concat('Microsoft.Compute/virtualMachineScaleSets/', variables('vmssName'))]" 1192 | ], 1193 | "properties": { 1194 | "name": "[concat('cpuautoscale', variables('namingInfix'))]", 1195 | "targetResourceUri": "[variables('vmssId')]", 1196 | "enabled": true, 1197 | "profiles": [ 1198 | { 1199 | "name": "Profile1", 1200 | "capacity": { 1201 | "minimum": "[parameters('autoscaleMin')]", 1202 | "maximum": "[parameters('autoscaleMax')]", 1203 | "default": "[parameters('autoscaleDefault')]" 1204 | }, 1205 | "rules": [ 1206 | { 1207 | "metricTrigger": { 1208 | "metricName": "Percentage CPU", 1209 | "metricNamespace": "", 1210 | "metricResourceUri": "[variables('vmssId')]", 1211 | "timeGrain": "PT1M", 1212 | "statistic": "Average", 1213 | "timeWindow": "PT5M", 1214 | "timeAggregation": "Average", 1215 | "operator": "GreaterThan", 1216 | "threshold": "[parameters('scaleOutCPUPercentageThreshold')]" 1217 | }, 1218 | "scaleAction": { 1219 | "direction": "Increase", 1220 | "type": "ChangeCount", 1221 | "value": "[parameters('scaleOutInterval')]", 1222 | "cooldown": "PT1M" 1223 | } 1224 | }, 1225 | { 1226 | "metricTrigger": { 1227 | "metricName": "Percentage CPU", 1228 | "metricNamespace": "", 1229 | "metricResourceUri": "[variables('vmssId')]", 1230 | "timeGrain": "PT1M", 1231 | "statistic": "Average", 1232 | "timeWindow": "PT5M", 1233 | "timeAggregation": "Average", 1234 | "operator": "LessThan", 1235 | "threshold": "[parameters('scaleInCPUPercentageThreshold')]" 1236 | }, 1237 | "scaleAction": { 1238 | "direction": "Decrease", 1239 | "type": "ChangeCount", 1240 | "value": "[parameters('scaleInInterval')]", 1241 | "cooldown": "PT1M" 1242 | } 1243 | } 1244 | ] 1245 | } 1246 | ] 1247 | } 1248 | } 1249 | ], 1250 | "outputs": { 1251 | "username": { 1252 | "type": "string", 1253 | "value": "[parameters('username')]" 1254 | }, 1255 | "VisualStudioServerName": { 1256 | "type": "string", 1257 | "value": "[variables('VisualStudioSrvName')]" 1258 | }, 1259 | "vmssServerFirstIPConfig": { 1260 | "type": "string", 1261 | "value": "[reference(variables('vmssFirstServerIP'),'2017-03-30').ipConfigurations[0].properties.privateIPAddress]" 1262 | }, 1263 | "ScaleSetPIPDNSname": { 1264 | "type": "string", 1265 | "value": "[reference(resourceId('Microsoft.Network/publicIPAddresses', variables('webSrvPublicIP')), '2015-06-15').dnsSettings.fqdn]" 1266 | } 1267 | } 1268 | } -------------------------------------------------------------------------------- /Student/Resources/azuredeploy.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "envPrefixName": { 6 | "value": "enter a 5 charactor value here all lowercase" 7 | }, 8 | "username": { 9 | "value": "vmadmin" 10 | }, 11 | "password": { 12 | "reference": { 13 | "keyVault": { 14 | "id": "/subscriptions/{guid}/resourceGroups/{group-name}/providers/Microsoft.KeyVault/vaults/{vault-name}" 15 | }, 16 | "secretName": "VMPassword" 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /monitoringhackdiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rkuehfus/AzureMonitoringHackathon/11efe51820f150e23da2426f080074e3eafdfaf9/monitoringhackdiagram.png --------------------------------------------------------------------------------