Skip to main content
command

appinsights-instrumentation — Claude Code command for Azure telemetry

Wires a webapp into Azure App Insights: the command reads your stack, asks where it runs, then adds telemetry.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --command azure/appinsights-instrumentation
Open on GitHub

What appinsights-instrumentation does

Reach for this when the app already runs in Azure but you have no view of its health. The command inspects the source to guess the language and framework, then asks you where the app is hosted — a local machine, App Service as code, App Service as a container, Container App.

For a C# ASP.NET Core app in Azure App Service it points you at auto-instrumentation via references/AUTO.md. Otherwise it creates the App Insights resource and updates the code: references/ASPNETCORE.md for C#, references/NODEJS.md for Node.js, references/PYTHON.md for Python. The resource comes either from adding to an existing Bicep template (see examples/appinsights.bicep) or from Azure CLI through scripts/appinsights.ps1.

Only two app types are supported: ASP.NET Core and Node.js hosted in Azure. That is the hard edge here — if your app is something else, check before you start. The command itself may use Bash and Read, so code changes land through the guides rather than automatically.

What it helps with

  • turn on telemetry for an ASP.NET Core app on Azure App Service
  • create an App Insights resource with Azure CLI or Bicep
  • add telemetry to a Node.js app running in Azure
  • work out the language, framework and hosting tuple before instrumenting
  • choose between auto-instrumentation and editing the code by hand

Example prompts for the agent

  • instrument my webapp to send telemetry to Azure App Insights
  • add App Insights to the existing Bicep template
  • set up App Insights for my Node.js app hosted in Azure

How to install appinsights-instrumentation

1claude-code-templates

npx claude-code-templates@latest --command azure/appinsights-instrumentation

2Manually: put the files in place

.claude/commands/appinsights-instrumentation.md

Call it with /appinsights-instrumentation. For all projects use ~/.claude/commands/

Questions about appinsights-instrumentation

How do I install appinsights-instrumentation in Claude?

Use the templates CLI: npx claude-code-templates@latest --command azure/appinsights-instrumentation. It lands at .claude/commands/appinsights-instrumentation.md.

What does appinsights-instrumentation do?

It connects a webapp to Azure App Insights so you can see how the app is doing. It first works out the language, framework and hosting, then either auto-instruments or creates the resource and edits the code.

Which apps does it support?

ASP.NET Core and Node.js apps hosted in Azure. C# on Azure App Service can be auto-instrumented; other cases go through the manual guides.

Source text

appinsights-instrumentation.md · MIT
---
allowed-tools: Bash, Read
description: Instrument a webapp to send useful telemetry data to Azure App Insights
---

# AppInsights instrumentation

This skill enables sending telemetry data of a webapp to Azure App Insights for better observability of the app's health.

## When to use this skill

Use this skill when the user wants to enable telemetry for their webapp.

## Prerequisites

The app in the workspace must be one of these kinds

- An ASP.NET Core app hosted in Azure
- A Node.js 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.

© davila7 · MIT · davila7/claude-code-templates

Similar slash commands

Everything for Cloud: AWS, Azure, GCP →

From the same set205

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor