Azure Functions (Isolated Worker)

Sentry provides an integration with Azure Functions through the Sentry.Azure.Functions.Worker NuGet package. All triggers are supported.

Install

Add the Sentry dependency to your Azure Functions application:

Copied
dotnet add package Sentry.Azure.Functions.Worker -v 3.41.3

This package extends Sentry.Extensions.Logging. This means that besides the Azure Functions related features, through this package you'll also get access to the ILogger<T> integration and also the features available in the main Sentry SDK.

Configure

Sentry integration with Azure Functions (when using the Isolated Worker Process execution mode) is done by calling .UseSentry() and specifying the options. E.g.:

Copied
var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults((host, builder) =>
    {
        builder.UseSentry(host, options =>
        {
            options.Dsn = "https://examplePublicKey@o0.ingest.sentry.io/0";
            options.EnableTracing = true;
            // When configuring for the first time, to see what the SDK is doing:
            // options.Debug = true;
        });
    })
    .Build();
await host.RunAsync();

Samples

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").