Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Caution
This article applies to Application Insights Classic resources, which are no longer recommended.
The information in this article is stale and won't be updated.
Transition to workspace-based Application Insights to take advantage of new capabilities.
Important
On February 29, 2024, support for classic Application Insights will end. Transition to workspace-based Application Insights to take advantage of new capabilities. Newer regions introduced after February 2021 don't support creating classic Application Insights resources.
This article includes sample Azure Resource Manager templates to deploy and configure classic Application Insights resources in conjunction with an Azure App Services web app. Each sample includes a template file and a parameters file with sample values to provide to the template.
Note
See Azure Monitor resource manager samples for a list of samples that are available and guidance on deploying them in your Azure subscription.
The following sample creates a basic Azure App Service web app with the .NET Core runtime and a classic Application Insights resource with monitoring enabled.
param subscriptionId string
param name string
param location string
param hostingPlanName string
param serverFarmResourceGroup string
param alwaysOn bool
param phpVersion string
param errorLink string
resource site 'Microsoft.Web/sites@2021-03-01' = {
name: name
location: location
properties: {
siteConfig: {
appSettings: [
{
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
value: reference('microsoft.insights/components/web-app-name-01', '2015-05-01').InstrumentationKey
}
{
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: reference('microsoft.insights/components/web-app-name-01', '2015-05-01').ConnectionString
}
{
name: 'ApplicationInsightsAgent_EXTENSION_VERSION'
value: '~2'
}
{
name: 'XDT_MicrosoftApplicationInsights_Mode'
value: 'default'
}
{
name: 'ANCM_ADDITIONAL_ERROR_PAGE_LINK'
value: errorLink
}
]
phpVersion: phpVersion
alwaysOn: alwaysOn
}
serverFarmId: '/subscriptions/${subscriptionId}/resourcegroups/${serverFarmResourceGroup}/providers/Microsoft.Web/serverfarms/${hostingPlanName}'
clientAffinityEnabled: true
}
dependsOn: [
webApp
]
}
resource webApp 'Microsoft.Insights/components@2020-02-02' = {
name: 'web-app-name-01'
location: location
kind: 'web'
properties: {
Application_Type: 'web'
Request_Source: 'rest'
}
}
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subscriptionId": {
"value": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"name": {
"value": "web-app-name-01"
},
"location": {
"value": "Central US"
},
"hostingPlanName": {
"value": "WebApplication2720191003010920Plan"
},
"serverFarmResourceGroup": {
"value": "Testwebapp01"
},
"alwaysOn": {
"value": true
},
"phpVersion": {
"value": "OFF"
},
"errorLink": {
"value": "https://web-app-name-01.scm.azurewebsites.net/detectors?type=tools&name=eventviewer"
}
}
}
The following sample creates a basic Azure App Service web app with the ASP.NET runtime and a classic Application Insights resource with monitoring enabled.
param subscriptionId string
param name string
param location string
param hostingPlanName string
param serverFarmResourceGroup string
param alwaysOn bool
param phpVersion string
param netFrameworkVersion string
resource sites 'Microsoft.Web/sites@2021-03-01' = {
name: name
location: location
properties: {
siteConfig: {
appSettings: [
{
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
value: reference('microsoft.insights/components/web-app-name-01', '2015-05-01').InstrumentationKey
}
{
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: reference('microsoft.insights/components/web-app-name-01', '2015-05-01').ConnectionString
}
{
name: 'ApplicationInsightsAgent_EXTENSION_VERSION'
value: '~2'
}
{
name: 'XDT_MicrosoftApplicationInsights_Mode'
value: 'default'
}
]
phpVersion: phpVersion
netFrameworkVersion: netFrameworkVersion
alwaysOn: alwaysOn
}
serverFarmId: '/subscriptions/${subscriptionId}/resourcegroups/${serverFarmResourceGroup}/providers/Microsoft.Web/serverfarms/${hostingPlanName}'
clientAffinityEnabled: true
}
dependsOn: [
webApp
]
}
resource webApp 'Microsoft.Insights/components@2020-02-02' = {
name: 'web-app-name-01'
location: location
kind: 'web'
properties: {
Application_Type: 'web'
Request_Source: 'rest'
}
}
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subscriptionId": {
"value": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"name": {
"value": "web-app-name-01"
},
"location": {
"value": "Central US"
},
"hostingPlanName": {
"value": "WebApplication2720191003010920Plan"
},
"serverFarmResourceGroup": {
"value": "Testwebapp01"
},
"alwaysOn": {
"value": true
},
"phpVersion": {
"value": "OFF"
},
"netFrameworkVersion": {
"value": "v4.0"
}
}
}
The following sample creates a basic Azure App Service Linux web app with the Node.js runtime and a classic Application Insights resource with monitoring enabled.
param subscriptionId string
param name string
param location string
param hostingPlanName string
param serverFarmResourceGroup string
param alwaysOn bool
param linuxFxVersion string
resource site 'Microsoft.Web/sites@2021-03-01' = {
name: name
location: location
properties: {
siteConfig: {
appSettings: [
{
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
value: reference('microsoft.insights/components/web-app-name-01', '2015-05-01').InstrumentationKey
}
{
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: reference('microsoft.insights/components/web-app-name-01', '2015-05-01').ConnectionString
}
{
name: 'ApplicationInsightsAgent_EXTENSION_VERSION'
value: '~2'
}
{
name: 'XDT_MicrosoftApplicationInsights_Mode'
value: 'default'
}
]
linuxFxVersion: linuxFxVersion
alwaysOn: alwaysOn
}
serverFarmId: '/subscriptions/${subscriptionId}/resourcegroups/${serverFarmResourceGroup}/providers/Microsoft.Web/serverfarms/${hostingPlanName}'
clientAffinityEnabled: false
}
dependsOn: [
webApp
]
}
resource webApp 'Microsoft.Insights/components@2020-02-02' = {
name: 'web-app-name-01'
location: location
kind: 'web'
properties: {
Application_Type: 'web'
Request_Source: 'rest'
}
}
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subscriptionId": {
"value": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"name": {
"value": "web-app-name-01"
},
"location": {
"value": "Central US"
},
"hostingPlanName": {
"value": "App-planTest01-916e"
},
"serverFarmResourceGroup": {
"value": "app_resource_group_custom"
},
"alwaysOn": {
"value": true
},
"linuxFxVersion": {
"value": "NODE|12-lts"
}
}
}
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in