Azure Application Insights API Key

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

azurerm_application_insights_api_key (Terraform)

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

Example Usage from GitHub

insights.tf#L8
resource "azurerm_application_insights_api_key" "aikey" {
  name                    = var.bot_name
  application_insights_id = azurerm_application_insights.ai.id
  read_permissions        = ["aggregate", "api", "draft", "extendqueries", "search"]
module.tf#L10
resource "azurerm_application_insights_api_key" "api_keys" {
  for_each                = var.api_permissions
  name                    = module.read_telemetry_name.naming_convention_output[each.key].names.0
  application_insights_id = azurerm_application_insights.insight.id
  read_permissions        = each.value.read_permissions
  write_permissions       = each.value.write_permissions
main.tf#L7
resource "azurerm_application_insights_api_key" "this" {
  application_insights_id = var.application_insights_id
  name                    = var.name
  read_permissions        = var.read_permissions
  write_permissions       = var.write_permissions

main.tf#L7
resource "azurerm_application_insights_api_key" "this" {
  application_insights_id = var.application_insights_id
  name                    = var.name
  read_permissions        = var.read_permissions
  write_permissions       = var.write_permissions

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 API key.

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 API Key?

Azure Application Insights API Key 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 API Key?

For Terraform, the mathieu-benoit/MyMonthlyBlogArticle.Bot, laludevops/Terraform-Azure and kevinhead/azurerm 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.