Skip to content

Instantly share code, notes, and snippets.

@MilenPavlov
Created December 7, 2015 11:44
Show Gist options
  • Save MilenPavlov/a1c3294f6ce4118fa4e5 to your computer and use it in GitHub Desktop.
Save MilenPavlov/a1c3294f6ce4118fa4e5 to your computer and use it in GitHub Desktop.
arm template
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"baseUriName": {
"type": "string"
},
"sqlServerName": {
"type": "string"
},
"databaseName": {
"type": "string"
},
"hostingPlanName": {
"type": "string"
},
"sqlDatabaseUserName": {
"type": "string",
"defaultValue": "etechadmin"
},
"sqlDatabasePassword": {
"type": "securestring"
},
"sqlDatabaseUriNameCollation": {
"type": "string",
"minLength": 1,
"defaultValue": "SQL_Latin1_General_CP1_CI_AS"
},
"resourceGroupName": {
"type": "string"
},
"sqlDatabaseUriNameEdition": {
"type": "string",
"defaultValue": "Standard",
"allowedValues": [
"Basic",
"Business",
"Premium",
"Standard",
"Web"
]
}
},
"variables": {
"resourceGroupLocation": "[resourceGroup().location]"
},
"resources": [
{
"name": "[parameters('sqlServerName')]",
"type": "Microsoft.Sql/servers",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [ ],
"tags": {
"displayName": "SqlServer"
},
"properties": {
"administratorLogin": "[parameters('sqlDatabaseUserName')]",
"administratorLoginPassword": "[parameters('sqlDatabasePassword')]",
"version": "12.0"
},
"resources": [
{
"name": "AllowAllWindowsAzureIps",
"type": "firewallrules",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[concat('Microsoft.Sql/servers/', parameters('sqlServerName'))]"
],
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "255.255.255.255"
}
},
{
"name": "[parameters('databaseName')]",
"type": "databases",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"kind": "v12.0",
"dependsOn": [
"[parameters('sqlServerName')]"
],
"tags": {
"displayName": "SqlDatabase"
},
"properties": {
"collation": "[parameters('sqlDatabaseUriNameCollation')]",
"edition": "[parameters('sqlDatabaseUriNameEdition')]",
"maxSizeBytes": "10737418240"
//10 gigs currently
}
}
]
},
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/serverfarms",
"name": "[parameters('hostingPlanName')]",
"location": "[resourceGroup().location]",
"properties": {
"name": "[parameters('hostingPlanName')]",
"workerSize": "0",
"numberOfWorkers": 1
},
"sku": {
"name": "S1",
"tier": "Standard",
"size": "S1",
"family": "S",
"capacity": 1
}
},
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/sites",
"name": "[concat(parameters('baseUriName'), '-Web')]",
"location": "[resourceGroup().location]",
"tags": {
"environment": "test",
"team": "ARM",
"displayName": "Web"
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-Web'))]",
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-Web'))]"
],
"kind": null,
"location": "[variables('resourceGroupLocation')]",
"name": "appsettings",
"properties": {
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-Web'))).InstrumentationKey]"
},
"type": "config"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-Web'))]"
],
"kind": null,
"location": "West Europe",
"name": "connectionstrings",
"type": "config",
"properties": {
"DefaultConnection": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', parameters('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('sqlDatabaseUserName'), '@', parameters('sqlServerName'), ';Password=', parameters('sqlDatabasePassword'), ';')]",
"type": "SQLAzure"
}
}
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
],
"properties": {
"name": "[concat(parameters('baseUriName'), '-Web')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
}
},
{
"name": "[concat(parameters('baseUriName'), '-Api')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Api"
},
"properties": {
"name": "[concat(parameters('baseUriName'), '-Api')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-Api'))]",
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-Api'))]"
],
"kind": null,
"location": "[variables('resourceGroupLocation')]",
"name": "appsettings",
"properties": {
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-Api'))).InstrumentationKey]"
},
"type": "config"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-Api'))]"
],
"kind": null,
"location": "West Europe",
"name": "connectionstrings",
"type": "config",
"properties": {
"DefaultConnection": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', parameters('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('sqlDatabaseUserName'), '@', parameters('sqlServerName'), ';Password=', parameters('sqlDatabasePassword'), ';')]",
"type": "SQLAzure"
}
}
}
]
},
{
"name": "[concat(parameters('baseUriName'), '-EtechIntegration')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "EtechIntegration"
},
"properties": {
"name": "[concat(parameters('baseUriName'), '-EtechIntegration')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-EtechIntegration'))]",
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-EtechIntegration'))]"
],
"kind": null,
"location": "[variables('resourceGroupLocation')]",
"name": "appsettings",
"properties": {
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-EtechIntegration'))).InstrumentationKey]"
},
"type": "config"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-EtechIntegration'))]"
],
"kind": null,
"location": "West Europe",
"name": "connectionstrings",
"type": "config",
"properties": {
"DefaultConnection": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', parameters('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('sqlDatabaseUserName'), '@', parameters('sqlServerName'), ';Password=', parameters('sqlDatabasePassword'), ';')]",
"type": "SQLAzure"
}
}
}
]
},
{
"name": "[concat(parameters('baseUriName'), '-JobQueue')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "JobQueue"
},
"properties": {
"name": "[concat(parameters('baseUriName'), '-JobQueue')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-JobQueue'))]",
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-JobQueue'))]"
],
"kind": null,
"location": "[variables('resourceGroupLocation')]",
"name": "appsettings",
"properties": {
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-JobQueue'))).InstrumentationKey]"
},
"type": "config"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-JobQueue'))]"
],
"kind": null,
"location": "West Europe",
"name": "connectionstrings",
"type": "config",
"properties": {
"DefaultConnection": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', parameters('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('sqlDatabaseUserName'), '@', parameters('sqlServerName'), ';Password=', parameters('sqlDatabasePassword'), ';')]",
"type": "SQLAzure"
}
}
}
]
},
{
"name": "[concat(parameters('baseUriName'), '-JobQueue-Dashboard')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "JobQueue-Dashboard"
},
"properties": {
"name": "[concat(parameters('baseUriName'), '-JobQueue-Dashboard')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-JobQueue-Dashboard'))]",
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-JobQueue-Dashboard'))]"
],
"kind": null,
"location": "[variables('resourceGroupLocation')]",
"name": "appsettings",
"properties": {
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-JobQueue-Dashboard'))).InstrumentationKey]"
},
"type": "config"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-JobQueue-Dashboard'))]"
],
"kind": null,
"location": "[variables('resourceGroupLocation')]",
"name": "connectionstrings",
"type": "config",
"properties": {
"DefaultConnection": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', parameters('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('sqlDatabaseUserName'), '@', parameters('sqlServerName'), ';Password=', parameters('sqlDatabasePassword'), ';')]",
"type": "SQLAzure"
}
}
}
]
},
{
"name": "[concat(parameters('baseUriName'), '-Support')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Support"
},
"properties": {
"name": "[concat(parameters('baseUriName'), '-Support')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-Support'))]",
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-Support'))]"
],
"kind": null,
"location": "[variables('resourceGroupLocation')]",
"name": "appsettings",
"properties":
{
"APPINSIGHTS_INSTRUMENTATIONKEY":"[reference(resourceId('Microsoft.Insights/components', concat(parameters('baseUriName'), '-Support'))).InstrumentationKey]"
}
,
"type": "config"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', concat(parameters('baseUriName'), '-Support'))]"
],
"kind": null,
"location": "[variables('resourceGroupLocation')]",
"name": "connectionstrings",
"type": "config",
"properties": {
"DefaultConnection": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', parameters('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('sqlDatabaseUserName'), '@', parameters('sqlServerName'), ';Password=', parameters('sqlDatabasePassword'), ';')]",
"type": "SQLAzure"
}
}
}
]
},
{
"name": "[concat(parameters('hostingPlanName'), '-', resourceGroup().name, '-WebScale')]",
"type": "Microsoft.Insights/autoscalesettings",
"location": "[variables('resourceGroupLocation')]",
"apiVersion": "2014-04-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"tags": {
"[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Web AutoScale"
},
"properties": {
"name": "[concat(parameters('hostingPlanName'), '-', resourceGroup().name, '-WebScale')]",
"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
},
"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
},
"scaleAction": {
"direction": "Decrease",
"type": "ChangeCount",
"value": 1,
"cooldown": "PT1H"
}
}
]
}
],
"enabled": true,
"targetResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
}
},
{
"name": "[concat(parameters('baseUriName'), '-Web')]",
"type": "Microsoft.Insights/components",
"location": "Central US",
"apiVersion": "2014-04-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', concat(parameters('baseUriName'), '-Web'))]"
],
"tags": {
"displayName": "Component Web"
},
"properties": {
"applicationId": "[concat(parameters('baseUriName'), '-Web')]"
}
},
{
"name": "[concat(parameters('hostingPlanName'), '-', resourceGroup().name, '-ApiScale')]",
"type": "Microsoft.Insights/autoscalesettings",
"location": "East US",
"apiVersion": "2014-04-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"tags": {
"[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Api AutoScale"
},
"properties": {
"name": "[concat(parameters('hostingPlanName'), '-', resourceGroup().name, '-ApiScale')]",
"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
},
"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
},
"scaleAction": {
"direction": "Decrease",
"type": "ChangeCount",
"value": 1,
"cooldown": "PT1H"
}
}
]
}
],
"enabled": true,
"targetResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
}
},
{
"name": "[concat(parameters('baseUriName'), '-Api')]",
"type": "Microsoft.Insights/components",
"location": "Central US",
"apiVersion": "2014-04-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', concat(parameters('baseUriName'), '-Api'))]"
],
"tags": {
"displayName": "Component Api"
},
"properties": {
"applicationId": "[concat(parameters('baseUriName'), '-Api')]"
}
},
{
"name": "[concat(parameters('baseUriName'), '-EtechIntegration')]",
"type": "Microsoft.Insights/components",
"location": "Central US",
"apiVersion": "2014-04-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', concat(parameters('baseUriName'), '-EtechIntegration'))]"
],
"tags": {
"displayName": "Component EtechIntegration"
},
"properties": {
"applicationId": "[concat(parameters('baseUriName'), '-EtechIntegration')]"
}
},
{
"name": "[concat(parameters('baseUriName'), '-JobQueue')]",
"type": "Microsoft.Insights/components",
"location": "Central US",
"apiVersion": "2014-04-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', concat(parameters('baseUriName'), '-JobQueue'))]"
],
"tags": {
"displayName": "Component JobQueue"
},
"properties": {
"applicationId": "[concat(parameters('baseUriName'), '-JobQueue')]"
}
},
{
"name": "[concat(parameters('baseUriName'), '-JobQueue-Dashboard')]",
"type": "Microsoft.Insights/components",
"location": "Central US",
"apiVersion": "2014-04-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', concat(parameters('baseUriName'), '-JobQueue-Dashboard'))]"
],
"tags": {
"displayName": "Component JobQueue-Dashboard"
},
"properties": {
"applicationId": "[concat(parameters('baseUriName'), '-JobQueue-Dashboard')]"
}
},
{
"name": "[concat(parameters('baseUriName'), '-Support')]",
"type": "Microsoft.Insights/components",
"location": "Central US",
"apiVersion": "2014-04-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', concat(parameters('baseUriName'), '-Support'))]"
],
"tags": {
"displayName": "Component Support"
},
"properties": {
"applicationId": "[concat(parameters('baseUriName'), '-Support')]"
}
}
],
"outputs": {
"webSiteUri": {
"type": "string",
"value": "[concat('http://',reference(resourceId('Microsoft.Web/sites', concat(parameters('baseUriName'), '-Web'))).hostNames[0])]"
},
"apiSiteUri": {
"type": "string",
"value": "[concat('http://',reference(resourceId('Microsoft.Web/sites', concat(parameters('baseUriName'), '-Api'))).hostNames[0])]"
},
"integrationSiteUri": {
"type": "string",
"value": "[concat('http://',reference(resourceId('Microsoft.Web/sites', concat(parameters('baseUriName'), '-EtechIntegration'))).hostNames[0])]"
},
"jobQueueSiteUri": {
"type": "string",
"value": "[concat('http://',reference(resourceId('Microsoft.Web/sites', concat(parameters('baseUriName'), '-JobQueue'))).hostNames[0])]"
},
"jobQueueDshboardSiteUri": {
"type": "string",
"value": "[concat('http://',reference(resourceId('Microsoft.Web/sites', concat(parameters('baseUriName'), '-JobQueue-Dashboard'))).hostNames[0])]"
},
"supportSiteUri": {
"type": "string",
"value": "[concat('http://',reference(resourceId('Microsoft.Web/sites', concat(parameters('baseUriName'), '-Support'))).hostNames[0])]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment