microsoft/enable-snapshot-debugger
Guide users through enabling the Application Insights Snapshot Debugger for .NET on their platform. Use this when asked to enable the snapshot debugger, set up snapshot collection, or when snapshot data is missing.
npx skills add https://github.com/microsoft/code-optimizations-skills --skill enable-snapshot-debugger
When asked to enable the Application Insights Snapshot Debugger for .NET, or when another skill (e.g., get-snapshot-debug-info, download-snapshot) determines that no snapshot data exists, follow these steps:
investigation-notes.md with the confirmed values. If only a resource ID is available, resolve the app ID using resolve-app-id.md.ai.snapshot.id custom dimensions (proves snapshots are being captured end-to-end).AppInsightsSnapshotCollectorLogs heartbeat events (proves the Snapshot Collector process is running, even without any captured snapshots).Interpret the results:
4a. Check for Snapshot Collector NuGet packages and code:
*.csproj files for:Microsoft.ApplicationInsights.SnapshotCollectorProgram.cs or Startup.cs for:AddSnapshotCollector (Classic SDK explicit registration)4b. If Snapshot Collector code IS present — run connection string match check:
The Snapshot Debugger is configured in code but producing no events on the target resource. A common cause is a connection string mismatch. Run check-connection-string-match.md to compare the app's configured connection string against the target resource.
4c. Infer environment from source code:
When source code is available, attempt to infer environment answers:
<TargetFramework> in *.csproj — net6.0, net8.0, etc. = .NET (modern); net48, net472 = .NET Framework.*.bicep or ARM templates — look for Microsoft.Web/sites (App Service), container resources, etc.If answers can be inferred, present them to the user for confirmation and skip the corresponding questions in step 5.
4d. If Snapshot Collector code is NOT present → proceed to step 5.
Question 1 (if runtime not inferred): What .NET runtime does your application target?
.NET (modern) — .NET 6, .NET 8, or later.NET Framework — .NET Framework 4.6.2 or laterQuestion 2 (if hosting not inferred): Where is your application hosted?
> Note: Snapshot Debugger currently supports Windows environments only. Linux and containers are not supported.
Fetch online first, fall back to local. Use max_length: 5000 for all web_fetch calls:
| Platform | Online URL | Local fallback |
|---|---|---|
| App Service (Windows) | https://learn.microsoft.com/en-us/azure/azure-monitor/snapshot-debugger/snapshot-debugger-app-service | enablement-overview.md |
| Azure Functions | https://learn.microsoft.com/en-us/azure/azure-monitor/snapshot-debugger/snapshot-debugger-function-app | enablement-overview.md |
| VMs / VMSS / Cloud Services / Service Fabric / On-premises | https://learn.microsoft.com/en-us/azure/azure-monitor/snapshot-debugger/snapshot-debugger-vm | enablement-overview.md |
| Platform | Method | Code Change? |
|---|---|---|
| App Service (Windows) | Azure Portal toggles (codeless) | No |
| Azure Functions (App Service plan) | Azure Portal toggles (codeless) | No |
| VMs / VMSS / Cloud Services | NuGet package + code | Yes |
| Service Fabric | NuGet package + code | Yes |
| On-premises | NuGet package + code | Yes |
Present the enablement instructions to the user in a clear, step-by-step format. Include:
Microsoft.ApplicationInsights.SnapshotCollector NuGet package (for code-based enablement)Application Insights Snapshot Debugger RBAC role requirementFor App Service (codeless):
For code-based enablement (VMs, VMSS, Service Fabric, on-premises):
dotnet add package Microsoft.ApplicationInsights.SnapshotCollector
// In Program.cs or Startup.cs
builder.Services.AddApplicationInsightsTelemetry();
// Snapshot Collector is auto-registered as a telemetry processor
// when the NuGet package is installed. No explicit AddSnapshotCollector() needed
// in most cases — the package auto-discovers via TelemetryProcessor configuration.
Alternatively, configure in appsettings.json:
{
"ApplicationInsights": {
"ConnectionString": "<YOUR_CONNECTION_STRING>"
},
"SnapshotCollectorConfiguration": {
"IsEnabled": true,
"ThresholdForSnapshotting": 1,
"MaximumSnapshotsRequired": 3,
"SnapshotsPerTenMinutesLimit": 1
}
}
ThresholdForSnapshotting: 1 means 1 *additional* occurrence after the first).If no snapshots appear after the expected wait time, suggest troubleshooting:
exceptions table)Application Insights Snapshot Debugger RBAC roleOnce snapshots are confirmed, suggest the user run the get-snapshot-debug-info skill to inspect exception details, or download-snapshot to get the dump file for offline analysis.
TrackExceptionThresholdForSnapshotting: 1)Take microsoft/enable-snapshot-debugger from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.