mcpbeat

Enable Snapshot Debugger

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.

6k tokens
context cost
the whole folder, loaded on every use
3
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
3
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/microsoft/code-optimizations-skills --skill enable-snapshot-debugger

What comes with it

13 523 bytes besides the instruction
references/enablement-overview.md
scripts/check-snapshot-status.md

The instruction itself

5 sections, as written by the author

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.md with 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.id custom dimensions (proves snapshots are being captured end-to-end).
  • Tier 2: Queries for AppInsightsSnapshotCollectorLogs heartbeat 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.
  • 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 *.csproj files for:
  • Microsoft.ApplicationInsights.SnapshotCollector
  • Search Program.cs or Startup.cs for:
  • 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 *.csprojnet6.0, net8.0, etc. = .NET (modern); net48, net472 = .NET Framework.
  • Hosting: Check for *.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.

  • 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: 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 |

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.SnapshotCollector NuGet package (for code-based enablement)
  • How to verify snapshots are being collected
  • The Application Insights Snapshot Debugger RBAC 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: 1 means 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 exceptions table)
  • Check that symbols (.pdb files) are published alongside the application
  • Verify the user has the Application Insights Snapshot Debugger RBAC 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-info skill to inspect exception details, or download-snapshot to get the dump file for offline analysis.

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

How to use it

Copy the folder

Take microsoft/enable-snapshot-debugger from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

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.