Resource Manager template samples for creating Application Insights resources
This article includes sample Azure Resource Manager templates to deploy and configure classic Application Insights resources and the new workspace-based Application Insights resources. 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.
Classic Application Insights resource
The following sample creates a classic Application Insights resource.
Template file
@description('Name of Application Insights resource.')
param name string
@description('Type of app you are deploying. This field is for legacy reasons and will not impact the type of App Insights resource you deploy.')
param type string
@description('Which Azure Region to deploy the resource to. This must be a valid Azure regionId.')
param regionId string
@description('See documentation on tags: https://learn.microsoft.com/azure/azure-resource-manager/management/tag-resources.')
param tagsArray object
@description('Source of Azure Resource Manager deployment')
param requestSource string
resource component 'Microsoft.Insights/components@2020-02-02' = {
name: name
location: regionId
tags: tagsArray
kind: 'other'
properties: {
Application_Type: type
Flow_Type: 'Bluefield'
Request_Source: requestSource
}
}
Parameter file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"type": {
"value": "web"
},
"name": {
"value": "my_app_insights_resource"
},
"regionId": {
"value": "westus2"
},
"tagsArray": {
"value": {}
},
"requestSource": {
"value": "CustomDeployment"
}
}
}
Workspace-based Application Insights resource
The following sample creates a workspace-based Application Insights resource.
Template file
@description('Name of Application Insights resource.')
param name string
@description('Type of app you are deploying. This field is for legacy reasons and will not impact the type of App Insights resource you deploy.')
param type string
@description('Which Azure Region to deploy the resource to. This must be a valid Azure regionId.')
param regionId string
@description('See documentation on tags: https://learn.microsoft.com/azure/azure-resource-manager/management/tag-resources.')
param tagsArray object
@description('Source of Azure Resource Manager deployment')
param requestSource string
@description('Log Analytics workspace ID to associate with your Application Insights resource.')
param workspaceResourceId string
resource component 'Microsoft.Insights/components@2020-02-02' = {
name: name
location: regionId
tags: tagsArray
kind: 'other'
properties: {
Application_Type: type
Flow_Type: 'Bluefield'
Request_Source: requestSource
WorkspaceResourceId: workspaceResourceId
}
}
Parameter file
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "my_workspace_based_resource"
},
"type": {
"value": "web"
},
"regionId": {
"value": "westus2"
},
"tagsArray": {
"value": {}
},
"requestSource": {
"value": "CustomDeployment"
},
"workspaceResourceId": {
"value": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/testxxxx/providers/microsoft.operationalinsights/workspaces/testworkspace"
}
}
}
Next steps
Feedback
Submit and view feedback for