Azure Functions

Learn about Sentry's .NET integration with Azure Functions.

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

Add the Sentry dependency to your Azure Functions application:

dotnet add package Sentry.Azure.Functions.Worker -v 4.9.0

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.

Sentry integration with Azure Functions is done by calling .UseSentry() and specifying the options, for example:

If using the ASP.NET Core integration add UseSentry to the ConfigureFunctionsWebApplication call instead.

using Sentry.Azure.Functions.Worker;

var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults((host, builder) =>
        builder.UseSentry(host, options =>
            options.Dsn = "";
            // When configuring for the first time, to see what the SDK is doing:
            options.Debug = true;
            // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
            // We recommend adjusting this value in production.
            options.TracesSampleRate = 1.0;
await host.RunAsync();

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").