Skip to content

Instantly share code, notes, and snippets.

@johndowns
Last active November 28, 2018 10:12
Show Gist options
  • Save johndowns/e0d42eab11da6d446a080c09e3e29402 to your computer and use it in GitHub Desktop.
Save johndowns/e0d42eab11da6d446a080c09e3e29402 to your computer and use it in GitHub Desktop.
{
"$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."
}
},
"alertsEmailAddress": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "The email address to which alerts should be sent."
}
}
},
"variables": {
"applicationInsightsName": "AppInsights",
"applicationInsightsSmartDetections": [
"slowpageloadtime",
"slowserverresponsetime",
"longdependencyduration",
"degradationinserverresponsetime",
"degradationindependencyduration"
]
},
"resources": [
{
"name": "[variables('applicationInsightsName')]",
"type": "Microsoft.Insights/components",
"apiVersion": "2014-04-01",
"location": "[parameters('applicationInsightsLocation')]",
"kind": "other",
"properties": {
"applicationId": "[variables('applicationInsightsName')]"
}
},
{
"comments": "Reconfigure Application Insights' default alerts to go to the right place",
"name": "[concat(variables('applicationInsightsName'), '/', variables('applicationInsightsSmartDetections')[copyIndex()])]",
"type": "Microsoft.Insights/components/proactiveDetectionConfigs",
"location": "[resourceGroup().location]",
"apiVersion": "2018-05-01-preview",
"copy": {
"name": "applicationInsightsSmartDetections",
"count": "[length(variables('applicationInsightsSmartDetections'))]"
},
"properties": {
"name": "[variables('applicationInsightsSmartDetections')[copyIndex()]]",
"sendEmailsToSubscriptionOwners": false,
"customEmails": [
"[parameters('alertsEmailAddress')]"
]
},
"dependsOn": [
"[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment