enable-snapshot-debugger
Skill5 starsChanged 5 months agoMITView on GitHub
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.
In this repository9 other files it gives its agents.
- agentic-optimizationSkill
- deep-analysisSkill
- download-profile-traceSkill
- download-snapshotSkill
- enable-profilerSkill
- error-explorationSkill
- get-profile-hotpathSkill
- get-snapshot-debug-infoSkill
- perf-optimizationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. About 0 are common, 13 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
When asked to enable the Application Insights Snapshot Debugger for .NET, or when another skill (e.g., get-snapshot-debug-info, …
- Distinctive: line 20
If snapshot-tagged exceptions are found → the Snapshot Debugger is fully active.
- Distinctive: line 22
If neither is found → the Snapshot Debugger is not enabled.
- Very specific: line 27
Search *.csproj files for:
- Very specific: line 29
Search Program.cs or Startup.cs for:
- Distinctive: line 35
If a mismatch is detected → present it to the user.
- Distinctive: line 36
If connection strings match → the Snapshot Debugger is configured and pointing to the correct resource, but not producing data for another …
- Distinctive: line 37
If no connection strings are found locally → the connection string may be set via environment variables or App Service configuration.
- Distinctive: line 40
When source code is available, attempt to infer environment answers:
- Very specific: line 41
Runtime: Check <TargetFramework> in *.csproj — net6.0, net8.0, etc.
- Very specific: line 42
Hosting: Check for *.bicep or ARM templates — look for Microsoft.Web/sites (App Service), container resources, etc.
- Distinctive: line 44
If answers can be inferred, present them to the user for confirmation and skip the corresponding questions in step 5.
- Very specific: line 68
Fetch online first, fall back to local: Use max_length: 5000 for all web_fetch calls:
- Distinctive: line 131
Wait 10–15 minutes for snapshots to be uploaded.
- Distinctive: line 134
If no snapshots appear after the expected wait time, suggest troubleshooting:
- Distinctive: line 135
Verify the connection string is correct
- Very specific: line 136
Ensure exceptions are actually being thrown (check the exceptions table)
- Distinctive: line 137
Check that symbols (.pdb files) are published alongside the application
- Very specific: line 138
Verify the user has the Application Insights Snapshot Debugger RBAC role
- Distinctive: line 140
Check application logs for Snapshot Collector startup messages
- Very specific: line 147
Default: snapshot created after the same exception occurs twice (ThresholdForSnapshotting: 1)
- Distinctive: line 152
Only one Snapshot Collector per application
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Enable Application Insights 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:
- Check investigation notes and gather inputs — Follow the Standard Skill Preamble to check for existing investigation context and gather inputs.
- Identify the Application Insights resource — If the investigation notes didn't have the resource or the user wants a different one, follow the steps in the Standard Skill Preamble. After the resource is confirmed, write or update
investigation-notes.mdwith the confirmed values. If only a resource ID is available, resolve the app ID using resolve-app-id.md. Check if the Snapshot Debugger is already active — Run the script in check-snapshot-status.md which performs a two-tier check:
- Tier 1: Queries for exceptions with
ai.snapshot.idcustom dimensions (proves snapshots are being captured end-to-end). - Tier 2: Queries for
AppInsightsSnapshotCollectorLogsheartbeat events (proves the Snapshot Collector process is running, even without any captured snapshots).
Interpret the results:
- If snapshot-tagged exceptions are found → the Snapshot Debugger is fully active. Inform the user and stop.
- If heartbeat events are found but no snapshots → the Snapshot Collector IS running but hasn't captured snapshots yet. This is normal when: the debugger was just enabled, traffic is low, no exceptions have been thrown, or exceptions haven't reached the snapshot threshold (default: same exception must occur twice). Do NOT recommend re-enabling. Instead, explain the situation and suggest generating traffic that triggers exceptions.
- If neither is found → the Snapshot Debugger is not enabled. Proceed to step 4.
- Tier 1: Queries for exceptions with
Check local source code for existing Snapshot Debugger configuration — Before asking the user environment questions, inspect the source code in the working directory.
4a. Check for Snapshot Collector NuGet packages and code:
- Search
*.csprojfiles for:Microsoft.ApplicationInsights.SnapshotCollector
- Search
Program.csorStartup.csfor:AddSnapshotCollector(Classic SDK explicit registration)
- Note: On App Service (Windows), Snapshot Debugger can be enabled without the NuGet package — it's preinstalled in the App Service runtime and controlled via portal toggles.
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.
- If a mismatch is detected → present it to the user. Connection strings are often overridden at deployment time, so a source-code mismatch doesn't necessarily mean data is going elsewhere. Ask the user to confirm before proceeding.
- If connection strings match → the Snapshot Debugger is configured and pointing to the correct resource, but not producing data for another reason. Continue to step 5.
- If no connection strings are found locally → the connection string may be set via environment variables or App Service configuration. Cannot verify from source code alone. Continue to step 5.
4c. Infer environment from source code: When source code is available, attempt to infer environment answers:
- Runtime: Check
<TargetFramework>in*.csproj—net6.0,net8.0, etc. = .NET (modern);net48,net472= .NET Framework. - Hosting: Check for
*.bicepor ARM templates — look forMicrosoft.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.
- Search
Determine the user's environment — Ask any questions not already answered by source code inspection:
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 later
Question 2 (if hosting not inferred): Where is your application hosted?
- Azure App Service (Windows)
- Azure Functions (App Service plan)
- Azure Cloud Services
- Azure Virtual Machines or Virtual Machine Scale Sets
- Azure Service Fabric
- Other / on-premises
Note: Snapshot Debugger currently supports Windows environments only. Linux and containers are not supported.
Provide enablement instructions — Based on the user's answers, fetch the relevant enablement documentation and provide step-by-step instructions.
Fetching enablement instructions
Fetch online first, fall back to local. Use
max_length: 5000for allweb_fetchcalls:Platform Online URL Local fallback App Service (Windows) https://learn.microsoft.com/en-us/azure/azure-monitor/snapshot-debugger/snapshot-debugger-app-serviceenablement-overview.md Azure Functions https://learn.microsoft.com/en-us/azure/azure-monitor/snapshot-debugger/snapshot-debugger-function-appenablement-overview.md VMs / VMSS / Cloud Services / Service Fabric / On-premises https://learn.microsoft.com/en-us/azure/azure-monitor/snapshot-debugger/snapshot-debugger-vmenablement-overview.md Enablement methods by platform
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:
- Prerequisites (Basic tier or higher for App Service, symbol files published)
- The specific portal steps or code changes required
- The
Microsoft.ApplicationInsights.SnapshotCollectorNuGet package (for code-based enablement) - How to verify snapshots are being collected
- The
Application Insights Snapshot DebuggerRBAC role requirement
For App Service (codeless):
- Navigate to App Service in the Azure portal
- Select Monitoring → Application Insights
- Turn on Application Insights (or select existing resource)
- Under the .NET tab, switch both Snapshot Debugger toggles to On
- Click Apply
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 } }Verify the Snapshot Debugger is producing data — After the user has enabled the Snapshot Debugger:
- The application must throw an exception twice for the same problem before a snapshot is created (default
ThresholdForSnapshotting: 1means 1 additional occurrence after the first). - Wait 10–15 minutes for snapshots to be uploaded.
- Re-run the check-snapshot-status.md script to confirm snapshot-tagged exceptions are appearing.
If no snapshots appear after the expected wait time, suggest troubleshooting:
- Verify the connection string is correct
- Ensure exceptions are actually being thrown (check the
exceptionstable) - Check that symbols (.pdb files) are published alongside the application
- Verify the user has the
Application Insights Snapshot DebuggerRBAC role - For App Service: ensure the app is on Basic tier or higher
- Check application logs for Snapshot Collector startup messages
Once snapshots are confirmed, suggest the user run the
get-snapshot-debug-infoskill to inspect exception details, ordownload-snapshotto get the dump file for offline analysis.- The application must throw an exception twice for the same problem before a snapshot is created (default
Key facts
- Snapshots are captured on first-chance exceptions that are also reported via
TrackException - Default: snapshot created after the same exception occurs twice (
ThresholdForSnapshotting: 1) - Maximum 50 snapshots per day can be uploaded
- Snapshot data is stored for 15 days
- Windows only — Linux and containers are not currently supported
- Minimal CPU/memory overhead — snapshots are created via suspended process clones
- Only one Snapshot Collector per application
- Snapshots may contain personal data in variable values — stored in the same region as the Application Insights resource
References
- Enablement Overview
- Check Snapshot Status
- Investigation Notes
- resolve-app-id.md
- az CLI Query Pitfalls
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

