-
Notifications
You must be signed in to change notification settings - Fork 6
How to enable profiler codelessly
The Azure Monitor Profiler site extension lets you enable the profiler on a Windows App Service without changing your application's source code, adding a NuGet package, or recompiling. Once installed, the profiler attaches automatically when your app starts, captures traces, and uploads them to Application Insights.
Beta. This is a public beta of codeless profiler enablement. See Known limitations below.
The site extension stages a small payload alongside your app and injects a few .NET environment variables into the worker process. On startup, the profiler:
- Detects which telemetry stack your app uses (OpenTelemetry or classic
Application Insights) by scanning your app's own
*.deps.json. - Enables the matching profiler automatically.
- Uploads captured traces to the Application Insights resource named by your app's connection string.
Enablement is fail-safe: if anything is misconfigured or incompatible, the profiler disables itself and your application keeps running — it will not crash your app.
-
A Windows App Service running a .NET / ASP.NET Core app (.NET 8, 9, or 10).
-
The app has an Application Insights connection string set. In the Azure portal: App Service → Settings → Environment variables → App settings, add or confirm:
APPLICATIONINSIGHTS_CONNECTION_STRING = <your connection string> -
Your app uses a supported telemetry stack:
-
OpenTelemetry (
Azure.Monitor.OpenTelemetry.AspNetCore, orMicrosoft.ApplicationInsights.AspNetCore3.x, or manual OpenTelemetry), or - Classic Application Insights SDK ≥ 2.23.0 and < 3.0.0.
-
OpenTelemetry (
If your app already references a profiler NuGet (
Azure.Monitor.OpenTelemetry.ProfilerorMicrosoft.ApplicationInsights.Profiler.AspNetCore), the site extension backs off automatically to avoid enabling the profiler twice.
- In the Azure portal, open your App Service.
- In the left menu, select Extensions.
- Select + Add.
- Choose Azure Monitor OpenTelemetry Profiler from the list.
- Accept the legal terms and select OK to install.
- When the install completes, restart the app so the worker process picks up the injected environment variables.
That's it — the profiler now activates codelessly every time the app starts.
-
Application Insights: After the app has taken some traffic, open your Application Insights resource and go to Investigate → Performance → Profiler (or the Profiler blade). Captured traces appear here within a few minutes.
-
Startup log (optional): Enable startup logging (see How to diagnose codeless startup) and look for lines such as:
[Azure.Monitor.OpenTelemetry.Profiler.StartupHook] Detected telemetry stack: OpenTelemetry [Azure.Monitor.OpenTelemetry.Profiler.HostingStartup] info: Enabling the Azure Monitor OpenTelemetry profiler.
If traces don't appear, or you want to confirm the profiler activated, enable startup logging and check the log. See How to diagnose codeless startup for the full steps.
- Upgrade: Install the newer version from the Extensions blade, then restart the app. The payload is staged in a version-stamped folder, so upgrades don't collide with files still in use by a running worker.
- Uninstall: Remove the extension from the Extensions blade and restart the app. The injected environment variables are cleaned up so the profiler no longer activates.
- .NET apps only. On non-.NET stacks (Node.js, Python, Java, PHP) the extension is a safe no-op — nothing is enabled and nothing breaks.
- Windows App Service only for the site extension. For Linux App Service (blessed .NET stack), use the enable script instead of a site extension.
- Runtime support: .NET 8, 9, and 10.
-
Minimum app dependency versions: for OpenTelemetry apps,
OpenTelemetrymust be ≥ 1.8.1 andAzure.Core≥ 1.46.1. For classic apps, the Application Insights SDK must be ≥ 2.23.0 and < 3.0.0. Apps below these floors are unsupported; the profiler disables itself rather than risking the app. -
A valid connection string is required. With a missing or invalid
APPLICATIONINSIGHTS_CONNECTION_STRING, the profiler disables itself (logged), but your app keeps running.