Skip to content
Application Insights Instrumentation

Application Insights Instrumentation Skill

Microsoft's official Azure skill for instrumenting web apps with Application Insights: SDK setup, auto-instrumentation and OpenTelemetry references for .NET, Node.js and Python.

GitHub Docs

Install

Install with the skills CLI

One command for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf and dozens of other agents. Needs Node.js; the skill is fetched straight from microsoft/azure-skills.

$ npx skills add microsoft/azure-skills --skill appinsights-instrumentation

Run it in a terminal. The CLI finds the agents installed on your machine, asks which ones to add the skill to, and whether to install it into the folder you ran it from or for all your projects.

Other ways to install

Copy the whole skill folder — SKILL.md and any scripts or references beside it — into ~/.claude/skills/appinsights-instrumentation/, where Claude Code picks it up in every project. Only git is needed.

tmp=$(mktemp -d) && \
  git clone --depth 1 --branch main https://github.com/microsoft/azure-skills.git "$tmp" && \
  mkdir -p ~/.claude/skills && \
  cp -R "$tmp"/skills/appinsights-instrumentation ~/.claude/skills/appinsights-instrumentation

No scripts or references next to it? Saving the SKILL.md alone as ~/.claude/skills/appinsights-instrumentation/SKILL.md works too.

Using another agent? Its personal skills folder
Codex
~/.agents/skills/
Cursor
~/.cursor/skills/
GitHub Copilot
~/.copilot/skills/
Gemini CLI
~/.gemini/skills/
Windsurf
~/.codeium/windsurf/skills/
OpenCode
~/.config/opencode/skills/

About

  • Guidance for adding Application Insights telemetry to Azure-hosted web apps
  • Covers ASP.NET Core, Node.js, Python and Azure Container Apps
  • Prefers auto-instrumentation for ASP.NET Core on App Service
  • Creates the App Insights resource via Bicep or Azure CLI
  • Azure Monitor OpenTelemetry Distro and Exporter references (Python, TypeScript, Java)
  • Routes actual code changes to the azure-prepare skill

appinsights-instrumentation is one of the skills in microsoft/azure-skills, Microsoft's official agent plugin for Azure. It is a reference skill: it teaches an agent how to add Azure Application Insights telemetry to a web app, and deliberately hands the actual project changes to the sibling azure-prepare skill when the user says "add App Insights to my app".

Supported apps. The skill scopes itself to four kinds of workload: an ASP.NET Core app hosted in Azure, an Azure Container App, a Node.js app hosted in Azure and a Python app hosted in Azure.

How it works. The agent first establishes the language, framework and hosting tuple by reading the source, and is told to always ask where the app is hosted (a personal machine, App Service as code or as a container, Container Apps). From there:

  • Auto-instrumentation is preferred for a C# ASP.NET Core app on App Service.
  • Manual instrumentation creates the Application Insights resource, either by adding it to an existing Bicep template or with an Azure CLI script, ideally in the same resource group as the app, then edits the code using per-language guides for ASP.NET Core, Node.js and Python.

SDK references. Quick references cover the Azure Monitor OpenTelemetry Distro for Python and TypeScript and the OpenTelemetry Exporter for Python and Java, plus an observability guide for Container Apps.

Useful for developers who want APM and telemetry on an Azure-hosted app without hunting through docs. MIT licensed, authored by Microsoft.

Try it

Once installed, ask your agent something like:

My ASP.NET Core API runs on Azure App Service. Show me how to get request and dependency telemetry into Application Insights, and whether I can do it without code changes.

SKILL.md

The instructions your agent loads, as published by Microsoft.

SKILL.md
name
appinsights-instrumentation
description
Guidance for instrumenting webapps with Azure Application Insights. Provides telemetry patterns, SDK setup, and configuration references. WHEN: how to instrument app, App Insights SDK, telemetry patterns, what is App Insights, Application Insights guidance, instrumentation examples, APM best practices.
license
MIT
metadata
author: Microsoft version: "1.2.2"

AppInsights Instrumentation Guide

This skill provides guidance and reference material for instrumenting webapps with Azure Application Insights.

⛔ ADDING COMPONENTS?

If the user wants to add App Insights to their app, invoke azure-prepare instead.
This skill provides reference material—azure-prepare orchestrates the actual changes.
When to Use This Skill
  • User asks how to instrument (guidance, patterns, examples)
  • User needs SDK setup instructions
  • azure-prepare invokes this skill during research phase
  • User wants to understand App Insights concepts
When to Use azure-prepare Instead
  • User says "add telemetry to my app"
  • User says "add App Insights"
  • User wants to modify their project
  • Any request to change/add components
Prerequisites

The app in the workspace must be one of these kinds

  • An ASP.NET Core app hosted in Azure
  • An Azure Container App
  • A Node.js app hosted in Azure
  • A Python app hosted in Azure
Guidelines
Collect context information

Find out the (programming language, application framework, hosting) tuple of the application the user is trying to add telemetry support in. This determines how the application can be instrumented. Read the source code to make an educated guess. Confirm with the user on anything you don't know. You must always ask the user where the application is hosted (e.g. on a personal computer, in an Azure App Service as code, in an Azure App Service as container, in an Azure Container App, etc.).

Prefer auto-instrument if possible

If the app is a C# ASP.NET Core app hosted in Azure App Service, use [AUTO guide](references/auto.md) to help user auto-instrument the app.

Manually instrument

Manually instrument the app by creating the AppInsights resource and update the app's code.

#### Create AppInsights resource

Use one of the following options that fits the environment.

  • Add AppInsights to existing Bicep template. See [examples/appinsights.bicep](examples/appinsights.bicep) for what to add. This is the best option if there are existing Bicep template files in the workspace.
  • Use Azure CLI. See [scripts/appinsights.ps1](scripts/appinsights.ps1) for what Azure CLI command to execute to create the App Insights resource.

No matter which option you choose, recommend the user to create the App Insights resource in a meaningful resource group that makes managing resources easier. A good candidate will be the same resource group that contains the resources for the hosted app in Azure.

#### Modify application code

  • If the app is an ASP.NET Core app, see [ASPNETCORE guide](references/aspnetcore.md) for how to modify the C# code.
  • If the app is a Node.js app, see [NODEJS guide](references/nodejs.md) for how to modify the JavaScript/TypeScript code.
  • If the app is a Python app, see [PYTHON guide](references/python.md) for how to modify the Python code.
SDK Quick References
  • OpenTelemetry Distro: [Python](references/sdk/azure-monitor-opentelemetry-py.md) | [TypeScript](references/sdk/azure-monitor-opentelemetry-ts.md)
  • OpenTelemetry Exporter: [Python](references/sdk/azure-monitor-opentelemetry-exporter-py.md) | [Java](references/sdk/azure-monitor-opentelemetry-exporter-java.md)
Platform-Specific Guides
  • Container Apps: [Observability Guide](references/container-apps.md)
Install
New

Microsoft's official skill for troubleshooting Azure production issues: App Service, Container Apps, Functions, AKS, VMs and messaging, using AppLens, Azure Monitor, resource health and KQL.

New

Microsoft's official Azure skill for moving workloads from AWS, GCP and Heroku: assess the source, convert code and config, e.g. Lambda to Functions or Cloud Run to Container Apps.

Browse all skills →