Created
July 5, 2018 18:33
-
-
Save Jandev/8902701fb486ea132010605d11b1eeab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "parameters": { | |
| "resourcegroup": { | |
| "type": "string" | |
| }, | |
| "hostingPlanName": { | |
| "type": "string", | |
| "minLength": 1 | |
| }, | |
| "skuName": { | |
| "type": "string", | |
| "defaultValue": "F1", | |
| "allowedValues": [ | |
| "F1", | |
| "D1", | |
| "B1", | |
| "B2", | |
| "B3", | |
| "S1", | |
| "S2", | |
| "S3", | |
| "P1", | |
| "P2", | |
| "P3", | |
| "P4" | |
| ], | |
| "metadata": { | |
| "description": "Describes plan's pricing tier and instance size. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/" | |
| } | |
| }, | |
| "skuCapacity": { | |
| "type": "int", | |
| "defaultValue": 1, | |
| "minValue": 1, | |
| "metadata": { | |
| "description": "Describes plan's instance count" | |
| } | |
| }, | |
| "websiteName": { | |
| "type": "string" | |
| }, | |
| "sqlServerName": { | |
| "type": "string" | |
| }, | |
| "databaseName": { | |
| "type": "string" | |
| }, | |
| "administratorLogin": { | |
| "type": "string" | |
| }, | |
| "administratorLoginPassword": { | |
| "type": "securestring" | |
| }, | |
| "vaultName": { | |
| "type": "string" | |
| }, | |
| "FeatureToggle.HostOwnImages": { | |
| "type": "bool" | |
| }, | |
| "servicebusQueueConnectionString": { | |
| "type": "securestring" | |
| } | |
| }, | |
| "variables": { | |
| }, | |
| "resources": [ | |
| { | |
| "apiVersion": "2015-08-01", | |
| "name": "[parameters('hostingPlanName')]", | |
| "type": "Microsoft.Web/serverfarms", | |
| "location": "[resourceGroup().location]", | |
| "tags": { | |
| "displayName": "HostingPlan" | |
| }, | |
| "sku": { | |
| "name": "[parameters('skuName')]", | |
| "capacity": "[parameters('skuCapacity')]" | |
| }, | |
| "properties": { | |
| "name": "[parameters('hostingPlanName')]" | |
| } | |
| }, | |
| { | |
| "apiVersion": "2015-08-01", | |
| "name": "[parameters('webSiteName')]", | |
| "type": "Microsoft.Web/sites", | |
| "location": "[resourceGroup().location]", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/serverFarms/', parameters('hostingPlanName'))]" | |
| ], | |
| "tags": { | |
| "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "empty", | |
| "displayName": "Website" | |
| }, | |
| "properties": { | |
| "name": "[parameters('webSiteName')]", | |
| "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]" | |
| }, | |
| "resources": [ | |
| { | |
| "apiVersion": "2015-08-01", | |
| "type": "config", | |
| "name": "connectionstrings", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/Sites/', parameters('webSiteName'))]" | |
| ], | |
| "properties": { | |
| "CfpExchangeDb": { | |
| "value": "[concat('Data Source=tcp:', reference(resourceId('Microsoft.Sql/servers/', parameters('sqlserverName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('administratorLogin'), '@', parameters('sqlserverName'), ';Password=', parameters('administratorLoginPassword'), ';')]", | |
| "type": "SQLServer" | |
| } | |
| } | |
| }, | |
| { | |
| "name": "appsettings", | |
| "type": "config", | |
| "apiVersion": "2015-08-01", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/Sites/', parameters('webSiteName'))]" | |
| ], | |
| "tags": { | |
| "displayName": "appSettings" | |
| }, | |
| "properties": { | |
| "ServicebusQueueConnectionString": "[parameters('servicebusQueueConnectionString')]", | |
| "FeatureToggle.HostOwnImages": "[parameters('FeatureToggle.HostOwnImages')]" | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "apiVersion": "2014-04-01", | |
| "name": "[concat(parameters('hostingPlanName'), '-', resourceGroup().name)]", | |
| "type": "Microsoft.Insights/autoscalesettings", | |
| "location": "[resourceGroup().location]", | |
| "tags": { | |
| "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource", | |
| "displayName": "AutoScaleSettings" | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]" | |
| ], | |
| "properties": { | |
| "profiles": [ | |
| { | |
| "name": "Default", | |
| "capacity": { | |
| "minimum": 1, | |
| "maximum": 2, | |
| "default": 1 | |
| }, | |
| "rules": [ | |
| { | |
| "metricTrigger": { | |
| "metricName": "CpuPercentage", | |
| "metricResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]", | |
| "timeGrain": "PT1M", | |
| "statistic": "Average", | |
| "timeWindow": "PT10M", | |
| "timeAggregation": "Average", | |
| "operator": "GreaterThan", | |
| "threshold": 80.0 | |
| }, | |
| "scaleAction": { | |
| "direction": "Increase", | |
| "type": "ChangeCount", | |
| "value": 1, | |
| "cooldown": "PT10M" | |
| } | |
| }, | |
| { | |
| "metricTrigger": { | |
| "metricName": "CpuPercentage", | |
| "metricResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]", | |
| "timeGrain": "PT1M", | |
| "statistic": "Average", | |
| "timeWindow": "PT1H", | |
| "timeAggregation": "Average", | |
| "operator": "LessThan", | |
| "threshold": 60.0 | |
| }, | |
| "scaleAction": { | |
| "direction": "Decrease", | |
| "type": "ChangeCount", | |
| "value": 1, | |
| "cooldown": "PT1H" | |
| } | |
| } | |
| ] | |
| } | |
| ], | |
| "enabled": false, | |
| "name": "[concat(parameters('hostingPlanName'), '-', resourceGroup().name)]", | |
| "targetResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]" | |
| } | |
| }, | |
| { | |
| "apiVersion": "2014-04-01", | |
| "name": "[concat('ServerErrors ', parameters('webSiteName'))]", | |
| "type": "Microsoft.Insights/alertrules", | |
| "location": "[resourceGroup().location]", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/sites/', parameters('webSiteName'))]" | |
| ], | |
| "tags": { | |
| "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('webSiteName'))]": "Resource", | |
| "displayName": "ServerErrorsAlertRule" | |
| }, | |
| "properties": { | |
| "name": "[concat('ServerErrors ', parameters('webSiteName'))]", | |
| "description": "[concat(parameters('webSiteName'), ' has some server errors, status code 5xx.')]", | |
| "isEnabled": false, | |
| "condition": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", | |
| "dataSource": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", | |
| "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('webSiteName'))]", | |
| "metricName": "Http5xx" | |
| }, | |
| "operator": "GreaterThan", | |
| "threshold": 0.0, | |
| "windowSize": "PT5M" | |
| }, | |
| "action": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", | |
| "sendToServiceOwners": true, | |
| "customEmails": [] | |
| } | |
| } | |
| }, | |
| { | |
| "apiVersion": "2014-04-01", | |
| "name": "[concat('ForbiddenRequests ', parameters('webSiteName'))]", | |
| "type": "Microsoft.Insights/alertrules", | |
| "location": "[resourceGroup().location]", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/sites/', parameters('webSiteName'))]" | |
| ], | |
| "tags": { | |
| "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('webSiteName'))]": "Resource", | |
| "displayName": "ForbiddenRequestsAlertRule" | |
| }, | |
| "properties": { | |
| "name": "[concat('ForbiddenRequests ', parameters('webSiteName'))]", | |
| "description": "[concat(parameters('webSiteName'), ' has some requests that are forbidden, status code 403.')]", | |
| "isEnabled": false, | |
| "condition": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", | |
| "dataSource": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", | |
| "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('webSiteName'))]", | |
| "metricName": "Http403" | |
| }, | |
| "operator": "GreaterThan", | |
| "threshold": 0, | |
| "windowSize": "PT5M" | |
| }, | |
| "action": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", | |
| "sendToServiceOwners": true, | |
| "customEmails": [] | |
| } | |
| } | |
| }, | |
| { | |
| "apiVersion": "2014-04-01", | |
| "name": "[concat('CPUHigh ', parameters('hostingPlanName'))]", | |
| "type": "Microsoft.Insights/alertrules", | |
| "location": "[resourceGroup().location]", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]" | |
| ], | |
| "tags": { | |
| "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource", | |
| "displayName": "CPUHighAlertRule" | |
| }, | |
| "properties": { | |
| "name": "[concat('CPUHigh ', parameters('hostingPlanName'))]", | |
| "description": "[concat('The average CPU is high across all the instances of ', parameters('hostingPlanName'))]", | |
| "isEnabled": false, | |
| "condition": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", | |
| "dataSource": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", | |
| "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]", | |
| "metricName": "CpuPercentage" | |
| }, | |
| "operator": "GreaterThan", | |
| "threshold": 90, | |
| "windowSize": "PT15M" | |
| }, | |
| "action": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", | |
| "sendToServiceOwners": true, | |
| "customEmails": [] | |
| } | |
| } | |
| }, | |
| { | |
| "apiVersion": "2014-04-01", | |
| "name": "[concat('LongHttpQueue ', parameters('hostingPlanName'))]", | |
| "type": "Microsoft.Insights/alertrules", | |
| "location": "[resourceGroup().location]", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]" | |
| ], | |
| "tags": { | |
| "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource", | |
| "displayName": "AutoScaleSettings" | |
| }, | |
| "properties": { | |
| "name": "[concat('LongHttpQueue ', parameters('hostingPlanName'))]", | |
| "description": "[concat('The HTTP queue for the instances of ', parameters('hostingPlanName'), ' has a large number of pending requests.')]", | |
| "isEnabled": false, | |
| "condition": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", | |
| "dataSource": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", | |
| "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]", | |
| "metricName": "HttpQueueLength" | |
| }, | |
| "operator": "GreaterThan", | |
| "threshold": 100.0, | |
| "windowSize": "PT5M" | |
| }, | |
| "action": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", | |
| "sendToServiceOwners": true, | |
| "customEmails": [] | |
| } | |
| } | |
| }, | |
| { | |
| "apiVersion": "2014-04-01", | |
| "name": "[parameters('webSiteName')]", | |
| "type": "Microsoft.Insights/components", | |
| "location": "West Europe", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/sites/', parameters('webSiteName'))]" | |
| ], | |
| "tags": { | |
| "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('webSiteName'))]": "Resource", | |
| "displayName": "AppInsightsComponent" | |
| }, | |
| "properties": { | |
| "ApplicationId": "[parameters('webSiteName')]" | |
| } | |
| } | |
| ], | |
| "outputs": { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment