Skip to content

Instantly share code, notes, and snippets.

# Create App Insights resource (3 steps)
## Add the Application Insights extension
az extension add -n application-insights
##Select the correct subscription
az account set --subscription "Microsoft Azure Enterprise"
## Create the Application Insights resource
az monitor app-insights component create --app $applicationInsightsResourceName --location $azureRegionName --resource-group AppInsights --workspace oms-vlm
# Query connection string of App Insights
az monitor app-insights component show --app $applicationInsightsResourceName --resource-group AppInsights --query connectionString --output tsv

Modify code

Make these necessary changes to the app.

  • Install client library
dotnet add package Microsoft.ApplicationInsights.WorkerService
  • Configure the app to use Azure Monitor

Modify code

Make these necessary changes to the app.

  • Install client library
dotnet add package Microsoft.ApplicationInsights.AspNetCore
  • Configure the app to use Azure Monitor

Modify code

Make these necessary changes to the app.

  • Install client library
npm install @microsoft/applicationinsights-angularplugin-js
  • Configure the Angular app to use Azure Monitor
name description
application-insights
Add instrumentation to an application to send useful telemetry data to Azure App Insights

AppInsights instrumentation

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

When to use this skill

name description argument-hint agent
init
Generate or update workspace instructions file for AI coding agents
Optionally specify a focus area or pattern to document for agents
agent

Related skill: agent-customization.

Generate or update workspace instructions (.github/copilot-instructions.md as first choice, or AGENTS.md if it is already present) for guiding AI coding agents in this workspace.

Import-Module WebAdministration
# Timestamp for file
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
$basePath = "D:\ServiceHealth\Logs"
# A unique identifier for this run
$jobId = [guid]::NewGuid().ToString()
$records = @()
// Add parallelism with no extra code — just configure the blocks:
var getFolderContents = new TransformManyBlock<string, string>(
folder => Directory.GetFileSystemEntries(folder),
new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 4 });
var computeMD5 = new TransformBlock<string, (string FilePath, string Hash)>(
filePath => /* ... */,
new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 8 });
string rootFolder = @"C:\Projects\MyApp";
getFolderContents.Post(rootFolder);
getFolderContents.Complete();
await displayResult.Completion;
var linkOptions = new DataflowLinkOptions { PropagateCompletion = true };
// RECURSION: If the entry is a directory, feed it back into the same block.
getFolderContents.LinkTo(getFolderContents, linkOptions,
entry => Directory.Exists(entry));
// BASE CASE: If the entry is a file, send it forward for hashing.
getFolderContents.LinkTo(computeMD5, linkOptions,
entry => File.Exists(entry));