Instantly share code, notes, and snippets.

@johndowns johndowns/apim-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."
}
},
"apiManagementPublisherEmailAddress": {
"type": "string",
"minLength": 1,
"defaultValue": "john.downs@kloud.com.au",
"metadata": {
"description": "The email address of the owner of the service"
}
},
"apiManagementPublisherName": {
"type": "string",
"minLength": 1,
"defaultValue": "john.downs@kloud.com.au",
"metadata": {
"description": "The name of the owner of the service"
}
},
"apiManagementSku": {
"type": "string",
"allowedValues": [
"Developer",
"Standard",
"Premium"
],
"defaultValue": "Developer",
"metadata": {
"description": "The pricing tier of this API Management service"
}
},
"apiManagementSkuCount": {
"type": "string",
"allowedValues": [
"1",
"2"
],
"defaultValue": "1",
"metadata": {
"description": "The instance size of this API Management service."
}
},
"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",
"apiManagementServiceName": "[concat('apiservice', parameters('uniqueResourceNameSuffix'))]",
"apiManagementLoggerName": "appinsights",
"apiManagementLoggerSamplingPercentage": 100
},
"resources": [
{
"name": "[variables('applicationInsightsName')]",
"type": "Microsoft.Insights/components",
"apiVersion": "2014-04-01",
"location": "[parameters('applicationInsightsLocation')]",
"kind": "other",
"properties": {
"applicationId": "[variables('applicationInsightsName')]"
}
},
{
"name": "[variables('apiManagementServiceName')]",
"type": "Microsoft.ApiManagement/service",
"apiVersion": "2017-03-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "[parameters('apiManagementSku')]",
"capacity": "[parameters('apiManagementSkuCount')]"
},
"properties": {
"publisherEmail": "[parameters('apiManagementPublisherEmailAddress')]",
"publisherName": "[parameters('apiManagementPublisherName')]"
},
"resources": [
{
"name": "[variables('apiManagementLoggerName')]",
"type": "loggers",
"apiVersion": "2018-06-01-preview",
"properties": {
"loggerType": "applicationInsights",
"resourceId": "[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]",
"credentials": {
"instrumentationKey": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2014-04-01').instrumentationKey]"
}
},
"dependsOn": [
"[resourceId('Microsoft.ApiManagement/service', variables('apiManagementServiceName'))]",
"[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]"
]
},
{
"name": "applicationinsights",
"type": "diagnostics",
"apiVersion": "2018-06-01-preview",
"properties": {
"alwaysLog": "allErrors",
"loggerId": "[resourceId('Microsoft.ApiManagement/service/loggers', variables('apiManagementServiceName'), variables('apiManagementLoggerName'))]",
"sampling": {
"samplingType": "fixed",
"percentage": "[variables('apiManagementLoggerSamplingPercentage')]"
}
},
"dependsOn": [
"[resourceId('Microsoft.ApiManagement/service', variables('apiManagementServiceName'))]",
"[resourceId('Microsoft.ApiManagement/service/loggers', variables('apiManagementServiceName'), variables('apiManagementLoggerName'))]"
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment