---
title: "Azure Functions"
description: "Learn about Sentry's .NET integration with Azure Functions."
url: https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/
---

# Azure Functions | Sentry for Azure Functions

Sentry provides an integration with Azure Functions through the [Sentry.Extensions.Logging](https://www.nuget.org/packages/Sentry.Extensions.Logging) and [Sentry.OpenTelemetry](https://www.nuget.org/packages/Sentry.OpenTelemetry) NuGet packages.

## [Features](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker.md#features)

In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](https://docs.sentry.io/concepts/key-terms/tracing.md).

Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.

## [Install](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker.md#install)

Error Monitoring\[ ]Tracing

Add the Sentry dependencies to your Azure Functions application:

```shell
dotnet add package Sentry.Extensions.Logging -v 6.3.1
// ___PRODUCT_OPTION_START___ performance
dotnet add package Sentry.OpenTelemetry -v 6.3.1
dotnet add package OpenTelemetry
dotnet add package OpenTelemetry.Extensions.Hosting
dotnet add package OpenTelemetry.Instrumentation.Http

// ___PRODUCT_OPTION_END___
```

The [Sentry.Extensions.Logging](https://docs.sentry.io/platforms/dotnet/guides/extensions-logging.md) package also provides access to the `ILogger<T>` integration and the other core features available in the [Sentry](https://docs.sentry.io/platforms/dotnet.md) SDK.

## [Configure](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker.md#configure)

The core features of Sentry are enabled by calling `AddSentry` when configuring logging.

Performance tracing can be enabled by adding Sentry to the OpenTelemetry `TracerProviderBuilder` and then configuring Sentry itself to use OpenTelemetry.

For example:

```csharp
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using OpenTelemetry;
// ___PRODUCT_OPTION_START___ performance
using OpenTelemetry.Trace;
// ___PRODUCT_OPTION_END___
using Sentry.OpenTelemetry;

var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults()
// ___PRODUCT_OPTION_START___ performance
    .ConfigureServices(services =>
    {
        services.AddOpenTelemetry().WithTracing(builder =>
        {
            builder
                .AddSentry() // <-- Configure OpenTelemetry to send traces to Sentry
                .AddHttpClientInstrumentation(); // From OpenTelemetry.Instrumentation.Http, instruments outgoing HTTP requests
        });
    })
// ___PRODUCT_OPTION_END___
    .ConfigureLogging(logging =>
    {
        logging.AddSentry(options =>
        {
            options.Dsn = "___PUBLIC_DSN___";
            // ___PRODUCT_OPTION_START___ performance
            options.TracesSampleRate = 1.0;
            options.UseOpenTelemetry(); // <-- Configure Sentry to use open telemetry
            options.DisableSentryHttpMessageHandler = true; // So Sentry doesn't also create spans for outbound HTTP requests
            // ___PRODUCT_OPTION_END___
            options.Debug = true;
        });
    })
    .Build();


await host.RunAsync();
```

## [Verify](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker.md#verify)

This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.

```csharp
try
{
    throw null;
}
catch (Exception ex)
{
    SentrySdk.CaptureException(ex);
}
```

## [Samples](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker.md#samples)

* [Azure Functions Sample](https://github.com/getsentry/sentry-dotnet/blob/main/samples/Sentry.Samples.OpenTelemetry.AzureFunctions/) demonstrates Sentry with Azure Functions Isolated Worker SDK. (**C#**)

## [Next Steps](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker.md#next-steps)

* Explore [practical guides](https://docs.sentry.io/guides.md) on what to monitor, log, track, and investigate after setup

## Other .NET Frameworks

- [.NET for Android](https://docs.sentry.io/platforms/dotnet/guides/android.md)
- [.NET for iOS, macOS, and Mac Catalyst](https://docs.sentry.io/platforms/dotnet/guides/apple.md)
- [ASP.NET](https://docs.sentry.io/platforms/dotnet/guides/aspnet.md)
- [ASP.NET Core](https://docs.sentry.io/platforms/dotnet/guides/aspnetcore.md)
- [AWS Lambda](https://docs.sentry.io/platforms/dotnet/guides/aws-lambda.md)
- [Blazor WebAssembly](https://docs.sentry.io/platforms/dotnet/guides/blazor-webassembly.md)
- [Entity Framework](https://docs.sentry.io/platforms/dotnet/guides/entityframework.md)
- [Google Cloud Functions](https://docs.sentry.io/platforms/dotnet/guides/google-cloud-functions.md)
- [log4net](https://docs.sentry.io/platforms/dotnet/guides/log4net.md)
- [MAUI](https://docs.sentry.io/platforms/dotnet/guides/maui.md)
- [Microsoft.Extensions.Logging](https://docs.sentry.io/platforms/dotnet/guides/extensions-logging.md)
- [NLog](https://docs.sentry.io/platforms/dotnet/guides/nlog.md)
- [Serilog](https://docs.sentry.io/platforms/dotnet/guides/serilog.md)
- [Windows Forms](https://docs.sentry.io/platforms/dotnet/guides/winforms.md)
- [WinUI](https://docs.sentry.io/platforms/dotnet/guides/winui.md)
- [WPF](https://docs.sentry.io/platforms/dotnet/guides/wpf.md)
- [Xamarin](https://docs.sentry.io/platforms/dotnet/guides/xamarin.md)

## Topics

- [Capturing Errors](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/usage.md)
- [Enriching Events](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/enriching-events.md)
- [Extended Configuration](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/configuration.md)
- [Logs](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/logs.md)
- [Data Management](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/data-management.md)
- [Tracing](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/tracing.md)
- [Security Policy Reporting](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/security-policy-reporting.md)
- [Crons](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/crons.md)
- [Migration Guide](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/migration.md)
- [Troubleshooting](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/troubleshooting.md)
- [User Feedback](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/user-feedback.md)
- [Metrics](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/metrics.md)
- [Unit Testing](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/unit-testing.md)
- [Legacy SDK](https://docs.sentry.io/platforms/dotnet/guides/azure-functions-worker/legacy-sdk.md)
