Skip to content

Instantly share code, notes, and snippets.

@johndowns johndowns/appservice-appinsights.json Secret
Last active Nov 28, 2018

Embed
What would you like to do?
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"applicationInsightsLocation": {
"type": "string",
"defaultValue": "westus2",
"allowedValues": [
"eastus",
"southcentralus",
"westus2",
"northeurope",
"westeurope",
"southeastasia"
],
"metadata": {
"description": "The location in which to deploy Application Insights, since it supports a subset of Azure regions."
}
},
"appServicePlanSku": {
"type": "string",
"defaultValue": "S1",
"metadata": {
"description": "The SKU (pricing tier) of the app service plan."
}
},
"appServicePlanCapacity": {
"type": "int",
"defaultValue": 1,
"metadata": {
"description": "The number of instances of the app service plan."
}
},
"uniqueResourceNameSuffix": {
"type": "string",
"defaultValue": "[uniqueString(subscription().subscriptionId, resourceGroup().id)]",
"metadata": {
"description": "The suffix to add to resource names that require global uniqueness."
}
}
},
"variables": {
"applicationInsightsName": "AppInsights",
"appServicePlanName": "WebApps",
"appName": "[concat('web', parameters('uniqueResourceNameSuffix'))]"
},
"resources": [
{
"name": "[variables('applicationInsightsName')]",
"type": "Microsoft.Insights/components",
"apiVersion": "2014-04-01",
"location": "[parameters('applicationInsightsLocation')]",
"kind": "web",
"properties": {
"applicationId": "[variables('applicationInsightsName')]"
}
},
{
"name": "[variables('appServicePlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"kind": "app",
"sku": {
"name": "S1",
"capacity": 1
},
"properties": {
"name": "[variables('appServicePlanName')]",
"numberOfWorkers": 1
}
},
{
"name": "[variables('appName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"kind": "web",
"properties": {
"name": "[variables('appName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]",
"httpsOnly": true,
"clientAffinityEnabled": false,
"siteConfig": {
"alwaysOn": true,
"ftpsState": "Disabled"
}
},
"resources": [
{
"name": "appsettings",
"type": "config",
"apiVersion": "2014-11-01",
"properties": {
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2014-04-01').instrumentationKey]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('appName'))]",
"[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]"
]
},
{
"name": "Microsoft.ApplicationInsights.AzureWebSites",
"type": "siteextensions",
"apiVersion": "2015-08-01",
"properties": {},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('appName'))]",
"[resourceId('Microsoft.Web/sites/config', variables('appName'), 'appsettings')]",
"[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]"
]
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.