Azure Application Insights Application Insights

This page shows how to write Terraform and Azure Resource Manager for Application Insights Application Insights and write them securely.

azurerm_application_insights (Terraform)

The Application Insights in Application Insights can be configured in Terraform with the resource name azurerm_application_insights. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

azurerm_application_insights.tf#L1
resource "azurerm_application_insights" "copy" {
  name                = format("copy-%s", random_string.copy_function_name.result)
  location            = random_shuffle.regions-with-az.result[0]
  resource_group_name = azurerm_resource_group.resource_group.name
  application_type    = "java"
  depends_on          = [azurerm_app_service_plan.primary_plan]
application_insights.tf#L2
resource "azurerm_application_insights" "appi_flume" {
  name                = "appi-lc-flume"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  application_type    = "web"
}
application_insights_test.tf#L11
resource "azurerm_application_insights" "usage" {
  name                = "tf-test-appinsights"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  application_type    = "web"
}
resources.tf#L1
resource "azurerm_application_insights" "panel" {
  name                = "panel-application-insights"
  application_type    = "web"
  location            = var.resource_group_location
  resource_group_name = var.resource_group_name
  workspace_id        = var.panel_id
main.tf#L12
resource "azurerm_application_insights" "production" {
  name                = "aggregator-telemetry"
  location            = azurerm_resource_group.production.location
  resource_group_name = azurerm_resource_group.production.name
  application_type    = "other"
  tags = {
main.tf#L58
resource "azurerm_application_insights" "appService-app_insights" {

  name                      =var.appinsitenameformyrepcenter
  resource_group_name      = var.resource_group_name
  location                 = var.location
  application_type          = "web" # Node.JS ,java
main.tf#L15
resource "azurerm_application_insights" "fail" {
  name                = "tf-appinsights-fail"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  application_type    = "web"

main.tf#L21
resource "azurerm_application_insights" "appinsight-app" {
  name                = var.app_name
  location            = var.location
  resource_group_name = var.resource_group_name
  application_type    = "web"
}
application_insights_test.tf#L11
resource "azurerm_application_insights" "usage" {
  name                = "tf-test-appinsights"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  application_type    = "web"
}
main.tf#L133
 resource "azurerm_application_insights" "AppInsightAPI" {
  name                = "AppInsightforAPI"
  location            = azurerm_resource_group.RGroup.location
  resource_group_name = azurerm_resource_group.RGroup.name
  application_type    = "web"
}

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages an Application Insights component.

Microsoft.Insights/components (Azure Resource Manager)

The components in Microsoft.Insights can be configured in Azure Resource Manager with the resource name Microsoft.Insights/components. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

ApplicationInsights.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "appinsights_name": {
monitor.app-insights.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
app_insight_beaapiprod_arm_template.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "components_az_func_bea_api_prod_name": {
template.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "channels_WebChatChannel_enablePreview": {
ApplicationInsights.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "appinsights_name": {
app_insight_nttottsaprod_arm_template.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "components_az_app_insight_ntto_ttsa_prod_name": {
monitor.app-insights.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
monitor.app-insights.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
ApplicationInsights.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "appinsights_name": {
Workbook_DF_Orchestrator.json
{
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workbookDisplayName": {
      "type": "string",

Frequently asked questions

What is Azure Application Insights Application Insights?

Azure Application Insights Application Insights is a resource for Application Insights of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Application Insights Application Insights?

For Terraform, the redisgeek/acre-terraform-cron-replication, finn-wa-log-cabin/lc-devops-terraform and gilyas/infracost source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the microsoft/azure-data-services-go-fast-codebase, plzm/azure-deploy and InternationalTradeAdministration/deploying-arm-template-mds-prod source code examples are useful. See the Azure Resource Manager Example section for further details.