{ "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "siteName": { "type": "string", "metadata": { "description": "The name of the web app that you wish to create." } }, "hostingPlanName": { "type": "string", "metadata": { "description": "The name of the App Service plan to use for hosting the web app." } }, "siteLocation": { "type": "string", "metadata": { "description": "The location to use for creating the web app and hosting plan." } }, "sku": { "type": "string", "allowedValues": [ "Free", "Shared", "Basic", "Standard" ], "defaultValue": "Free", "metadata": { "description": "The pricing tier for the hosting plan." } }, "workerSize": { "type": "string", "allowedValues": [ "0", "1", "2" ], "defaultValue": "0", "metadata": { "description": "The instance size of the hosting plan (small, medium, or large)." } }, "serverName": { "type": "string", "metadata": { "description": "The name of the new database server to create." } }, "serverLocation": { "type": "string", "metadata": { "description": "The location of the database server. For best performance, this location should be the same as the location of the web app." } }, "administratorLogin": { "type": "string", "metadata": { "description": "The account name to use for the database server administrator." } }, "administratorLoginPassword": { "type": "securestring", "metadata": { "description": "The password to use for the database server administrator." } }, "databaseName": { "type": "string", "metadata": { "description": "The name of the new database to create." } }, "collation": { "type": "string", "defaultValue": "SQL_Latin1_General_CP1_CI_AS", "metadata": { "description": "The database collation for governing the proper use of characters." } }, "edition": { "type": "string", "defaultValue": "Web", "metadata": { "description": "The type of database to create." } }, "maxSizeBytes": { "type": "string", "defaultValue": "1073741824", "metadata": { "description": "The maximum size, in bytes, for the database" } }, "requestedServiceObjectiveId": { "type": "string", "defaultValue": "910b4fcb-8a29-4c3e-958f-f7ba794388b2", "metadata": { "description": "The GUID corresponding to the performance level for edition." } } }, "resources": [ { "name": "[parameters('serverName')]", "type": "Microsoft.Sql/servers", "location": "[parameters('serverLocation')]", "apiVersion": "2.0", "properties": { "administratorLogin": "[parameters('administratorLogin')]", "administratorLoginPassword": "[parameters('administratorLoginPassword')]" }, "resources": [ { "name": "[parameters('databaseName')]", "type": "databases", "location": "[parameters('serverLocation')]", "apiVersion": "2.0", "dependsOn": [ "[concat('Microsoft.Sql/servers/', parameters('serverName'))]" ], "properties": { "edition": "[parameters('edition')]", "collation": "[parameters('collation')]", "maxSizeBytes": "[parameters('maxSizeBytes')]", "requestedServiceObjectiveId": "[parameters('requestedServiceObjectiveId')]" } }, { "apiVersion": "2.0", "dependsOn": [ "[concat('Microsoft.Sql/servers/', parameters('serverName'))]" ], "location": "[parameters('serverLocation')]", "name": "AllowAllWindowsAzureIps", "properties": { "endIpAddress": "0.0.0.0", "startIpAddress": "0.0.0.0" }, "type": "firewallrules" } ] }, { "apiVersion": "2014-06-01", "name": "[parameters('hostingPlanName')]", "type": "Microsoft.Web/serverFarms", "location": "[parameters('siteLocation')]", "properties": { "name": "[parameters('hostingPlanName')]", "sku": "[parameters('sku')]", "workerSize": "[parameters('workerSize')]", "numberOfWorkers": 1 } }, { "apiVersion": "2014-06-01", "name": "[parameters('siteName')]", "type": "Microsoft.Web/Sites", "location": "[parameters('siteLocation')]", "dependsOn": ["[concat('Microsoft.Web/serverFarms/', parameters('hostingPlanName'))]"], "tags": { "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "empty" }, "properties": { "name": "[parameters('siteName')]", "serverFarmId": "[parameters('hostingPlanName')]" }, "resources": [ { "apiVersion": "2014-11-01", "type": "config", "name": "connectionstrings", "dependsOn": [ "[concat('Microsoft.Web/Sites/', parameters('siteName'))]" ], "properties": { "DefaultConnection":{ "value":"[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', parameters('serverName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('administratorLogin'), '@', parameters('serverName'), ';Password=', parameters('administratorLoginPassword'), ';')]", "type": 2 } } } ] }, { "apiVersion": "2014-04-01", "name": "[concat(parameters('hostingPlanName'), '-', resourceGroup().name)]", "type": "microsoft.insights/autoscalesettings", "location": "East US", "tags": {"[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource"}, "dependsOn": ["[concat('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('siteName'))]", "type": "microsoft.insights/alertrules", "location": "East US", "dependsOn": ["[concat('Microsoft.Web/sites/', parameters('siteName'))]"], "tags": {"[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('siteName'))]": "Resource"}, "properties": { "name": "[concat('ServerErrors ', parameters('siteName'))]", "description": "[concat(parameters('siteName'), ' has some server errors, status code 5xx.')]", "isEnabled": false, "condition": { "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition", "dataSource": { "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource", "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('siteName'))]", "metricName": "Http5xx" }, "operator": "GreaterThan", "threshold": 0.0, "windowSize": "PT5M" }, "action": { "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction", "sendToServiceOwners": true, "customEmails": [] } } }, { "apiVersion": "2014-04-01", "name": "[concat('ForbiddenRequests ', parameters('siteName'))]", "type": "microsoft.insights/alertrules", "location": "East US", "dependsOn": [ "[concat('Microsoft.Web/sites/', parameters('siteName'))]" ], "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('siteName'))]": "Resource" }, "properties": { "name": "[concat('ForbiddenRequests ', parameters('siteName'))]", "description": "[concat(parameters('siteName'), ' has some requests that are forbidden, status code 403.')]", "isEnabled": false, "condition": { "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition", "dataSource": { "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource", "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('siteName'))]", "metricName": "Http403" }, "operator": "GreaterThan", "threshold": 0, "windowSize": "PT5M" }, "action": { "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction", "sendToServiceOwners": true, "customEmails": [] } } }, { "apiVersion": "2014-04-01", "name": "[concat('CPUHigh ', parameters('hostingPlanName'))]", "type": "microsoft.insights/alertrules", "location": "East US", "dependsOn": [ "[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]" ], "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource" }, "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.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition", "dataSource": { "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource", "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]", "metricName": "CpuPercentage" }, "operator": "GreaterThan", "threshold": 90, "windowSize": "PT15M" }, "action": { "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction", "sendToServiceOwners": true, "customEmails": [] } } }, { "apiVersion": "2014-04-01", "name": "[concat('LongHttpQueue ', parameters('hostingPlanName'))]", "type": "microsoft.insights/alertrules", "location": "East US", "dependsOn": [ "[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]" ], "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource" }, "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.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition", "dataSource": { "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.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.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction", "sendToServiceOwners": true, "customEmails": [] } } }, { "apiVersion": "2014-04-01", "name": "[parameters('siteName')]", "type": "microsoft.insights/components", "location": "Central US", "dependsOn": [ "[concat('Microsoft.Web/sites/', parameters('siteName'))]" ], "tags": { "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('siteName'))]": "Resource" }, "properties": { "ApplicationId": "[parameters('siteName')]" } } ] }