Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/deployment/azure/application-insights.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,40 @@ Azure Application Insights, a feature of Azure Monitor, excels in Application Pe

To use Application insights, you specify its configuration in the AppHost project *and* use the [Azure Monitor distro in the service defaults project](#use-the-azure-monitor-distro).

## Understanding telemetry options

Aspire provides flexibility in how telemetry is collected and sent to Application Insights. There are two primary approaches for integrating with Application Insights:

### Classic Application Insights SDK

The classic Application Insights SDK is the traditional method for instrumenting .NET applications. It provides features such as:

- Built-in telemetry collection for HTTP requests, dependencies, exceptions, and more.
- Custom telemetry via the `TelemetryClient` API.

However, this SDK is not compatible with OpenTelemetry-based configurations used by Aspire's `AddServiceDefaults()` method.

### OpenTelemetry with Azure Monitor

OpenTelemetry is a modern standard for telemetry collection. Aspire uses OpenTelemetry for tracing and metrics through its `AddServiceDefaults()` method. With OpenTelemetry:

- Telemetry is vendor-agnostic, allowing integration with multiple backends.
- You can use the Azure Monitor OpenTelemetry Distro to send telemetry to Application Insights.

**Key differences:**

| Feature | Classic Application Insights SDK | OpenTelemetry with Azure Monitor |
|---------------------------------|-----------------------------------------|------------------------------------------|
| **Ease of Use** | Requires manual setup for advanced features. | Offers a more modern, standardized API. |
| **Compatibility** | Not compatible with OpenTelemetry setups. | Fully compatible with Aspire defaults. |
| **Extensibility** | Limited to Application Insights features. | Open, vendor-neutral, supports other backends. |
| **Instrumentation Standards** | Application-specific APIs (for example, `TelemetryClient`). | OpenTelemetry standards. |

For detailed guidance on each approach, see:

- [Classic Application Insights SDK Documentation](/azure/azure-monitor/app/asp-net-core)
- [OpenTelemetry for Azure Monitor](/azure/azure-monitor/app/opentelemetry-add-modify?tabs=aspnetcore)

## Choosing how Application Insights is provisioned

.NET Aspire has the capability to provision cloud resources as part of cloud deployment, including Application Insights. In your .NET Aspire project, you can decide if you want .NET Aspire to provision an Application Insights resource when deploying to Azure. You can also select to use an existing Application Insights resource by providing its connection string. The connection information is managed by the resource configuration in the AppHost project.
Expand Down
2 changes: 1 addition & 1 deletion docs/messaging/azure-service-bus-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ By default, the Service Bus emulator container when configured by .NET Aspire, e
| Endpoint | Image | Container port | Host port |
|--|--|--|--|
| `emulator` | `mcr.microsoft.com/azure-messaging/servicebus-emulator` | 5672 | dynamic |
| `tcp` | `mcr.microsoft.com/azure-sql-edge` | 1433 | dynamic |
| `tcp` | `mcr.microsoft.com/mssql/server` | 1433 | dynamic |

The port that it's listening on is dynamic by default. When the container starts, the port is mapped to a random port on the host machine. To configure the endpoint port, chain calls on the container resource builder provided by the `RunAsEmulator` method and then the <xref:Aspire.Hosting.AzureServiceBusExtensions.WithHostPort(Aspire.Hosting.ApplicationModel.IResourceBuilder{Aspire.Hosting.Azure.AzureServiceBusEmulatorResource},System.Nullable{System.Int32})> as shown in the following example:

Expand Down