Appinsights Instrumentation
GitHubOfficialCreated by Microsoft CorporationDistributed by GitHub
- Skill
- Tool integration
- Cloud and DevOps
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to integrating Azure App Insights into web applications. It guides users through identifying the appropriate instrumentation method based on their application's language, framework, and hosting environment. The skill supports both auto-instrumentation for specific Azure App Service configurations and manual instrumentation for broader scenarios, including code modifications and infrastructure-as-code updates.
What it does
- Determines the optimal instrumentation strategy based on application context.
- Provides guidance on auto-instrumenting ASP.NET Core and Node.js apps in Azure App Service.
- Offers instructions for manual code instrumentation across ASP.NET Core, Node.js, and Python.
- Assists in creating Azure App Insights resources via Bicep templates or Azure CLI.
- Explains how to configure application connection strings using environment variables.
When to use it
- When you need to monitor the health and performance of a web application.
- When setting up observability for ASP.NET Core, Node.js, or Python applications.
- When you need to integrate telemetry into existing Azure-hosted infrastructure.
- When you want to transition from legacy configuration methods to environment variable-based settings.
Advantages
- Supports both codeless auto-instrumentation and manual code-level control.
- Promotes modern configuration practices using environment variables.
- Integrates with existing infrastructure-as-code workflows.
- Provides clear paths for different programming languages and hosting environments.
Usage examples
- “How do I add App Insights to my ASP.NET Core app?”
- The agent will guide you through installing the necessary NuGet package, updating your Program.cs file, and configuring the connection string via environment variables.
- “Can I enable monitoring for my Node.js app on Azure without changing code?”
- The agent will verify if your app is hosted in Azure App Service and provide the direct link to the Azure Portal monitoring settings to enable auto-instrumentation.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/github/appinsights-instrumentation/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip appinsights-instrumentation.zip -d .agents/skills
Documentation by Microsoft Corporation
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 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 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 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 for how to modify the C# code.
If the app is a Node.js app, see NODEJS guide for how to modify the JavaScript/TypeScript code.
If the app is a Python app, see PYTHON guide for how to modify the Python code.
Files
- ATTRIBUTION.mdAdded by AutoGineer1.0 KiB
- LICENSE.txt1.1 KiB
- SKILL.md2.4 KiB
- examples/appinsights.bicep759 B
- references/ASPNETCORE.md1.7 KiB
- references/AUTO.md891 B
- references/NODEJS.md1.8 KiB
- references/PYTHON.md1.8 KiB
- scripts/appinsights.ps1Script1.2 KiB
references/PYTHON.md
Modify code
Make these necessary changes to the app.
Install client library
pip install azure-monitor-opentelemetryConfigure the app to use Azure Monitor Python applications send telemetry via the logger class in Python standard library. Create a module that configures and creates a logger that can send telemetry.
import logging
from azure.monitor.opentelemetry import configure_azure_monitor
configure_azure_monitor(
logger_name="<your_logger_namespace>"
)
logger = logging.getLogger("<your_logger_namespace>")Note: since we modified the code of the app, it needs to be deployed to take effect.
Configure App Insights connection string
The App Insights resource has a connection string. Add the connection string as an environment variable of the running app. You can use Azure CLI to query the connection string of the App Insights resource. See [scripts/appinsights.ps1] for what Azure CLI command to execute for querying the connection string.
After getting the connection string, set this environment variable with its value.
"APPLICATIONINSIGHTS_CONNECTION_STRING={your_application_insights_connection_string}"If the app has IaC template such as Bicep or terraform files representing its cloud instance, this environment variable should be added to the IaC template to be applied in each deployment. Otherwise, use Azure CLI to manually apply the environment variable to the cloud instance of the app. See what Azure CLI command to execute for setting this environment variable.
Send data
Create a logger that is configured to send telemetry.
logger = logging.getLogger("<your_logger_namespace>")
logger.setLevel(logging.INFO)Then send telemetry events by calling its logging methods.
logger.info("info log")Requirements and compatibility
Written for: GitHub Copilot
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
What our scanner noticed· Low risk
- Instructions that use the network
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Microsoft Corporation
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/appinsights-instrumentation · commit 797337f
- Licence
- MIT License (redistribution allowed)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Microsoft Corporation or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download appinsights-instrumentation.zip