NetEvolve.HealthChecks.Azure.Search 5.13.51

Prefix Reserved
dotnet add package NetEvolve.HealthChecks.Azure.Search --version 5.13.51
                    
NuGet\Install-Package NetEvolve.HealthChecks.Azure.Search -Version 5.13.51
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetEvolve.HealthChecks.Azure.Search" Version="5.13.51" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetEvolve.HealthChecks.Azure.Search" Version="5.13.51" />
                    
Directory.Packages.props
<PackageReference Include="NetEvolve.HealthChecks.Azure.Search" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NetEvolve.HealthChecks.Azure.Search --version 5.13.51
                    
#r "nuget: NetEvolve.HealthChecks.Azure.Search, 5.13.51"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NetEvolve.HealthChecks.Azure.Search@5.13.51
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NetEvolve.HealthChecks.Azure.Search&version=5.13.51
                    
Install as a Cake Addin
#tool nuget:?package=NetEvolve.HealthChecks.Azure.Search&version=5.13.51
                    
Install as a Cake Tool

NetEvolve.HealthChecks.Azure.Search

NuGet NuGet

This package provides a health check for Azure AI Search (formerly Azure Cognitive Search), based on the Azure.Search.Documents package. The main purpose is to check that the Azure Search service and a specific search index is reachable and that the client can connect to it.

💡 This package is available for .NET 8.0 and later.

Installation

To use this package, you need to add the package to your project. You can do this by using the NuGet package manager or by using the dotnet CLI.

dotnet add package NetEvolve.HealthChecks.Azure.Search

Health Check - Azure Search Index Availability

The health check is a liveness check. It will check that the Azure AI Search service and the specified search index is reachable and that the client can connect to it. If the service or the index needs longer than the configured timeout to respond, the health check will return Degraded. If the service or the index is not reachable, the health check will return Unhealthy.

Usage

After adding the package, you need to import the namespace NetEvolve.HealthChecks.Azure.Search and add the health check to the service collection.

using NetEvolve.HealthChecks.Azure.Search;

Therefore, you can use two different approaches. In both approaches you have to provide a name for the health check.

Parameters

  • name: The name of the health check. The name is used to identify the configuration object. It is required and must be unique within the application.
  • options: The configuration options for the health check. If you don't provide any options, the health check will use the configuration based approach.
  • tags: The tags for the health check. The tags search, azure and cognitive are always used as default and combined with the user input. You can provide additional tags to group or filter the health checks.

Variant 1: Configuration based

The first one is to use the configuration based approach. Therefore, you have to add the configuration section HealthChecks:SearchAvailable to your appsettings.json file.

var builder = services.AddHealthChecks();

builder.AddAzureSearch("<name>");

The configuration looks like this:

{
  ..., // other configuration
  "HealthChecks": {
    "SearchAvailable": {
      "<name>": {
        "ServiceUri": "https://your-search-service.search.windows.net", // required
        "IndexName": "<index-name>", // required
        "Mode": "DefaultAzureCredentials", // optional, default is ServiceProvider
        "ApiKey": "<api-key>", // optional, required when Mode is AzureKeyCredential
        ..., // other configuration
        "Timeout": "<timeout>" // optional, default is 100 milliseconds
      }
    }
  }
}

Variant 2: Options based

The second one is to use the options based approach. Therefore, you have to create an instance of SearchAvailableOptions and provide the configuration.

var builder = services.AddHealthChecks();

builder.AddAzureSearch("<name>", options =>
{
    options.ServiceUri = new Uri("https://your-search-service.search.windows.net");
    options.IndexName = "<index-name>";
    options.Mode = ClientCreationMode.DefaultAzureCredentials;
    ...
    options.Timeout = "<timeout>";
});

Configuration

Client Creation Modes

The package supports three different modes to create the SearchClient:

  • ServiceProvider (default): Retrieves the client from the service provider. This requires registering SearchClient in the dependency injection container.
  • DefaultAzureCredentials: Creates a client using Azure Default Credentials. This is recommended for production environments and supports managed identities.
  • AzureKeyCredential: Creates a client using an API key. This is useful for development and testing scenarios.

Mode: ServiceProvider

When using the ServiceProvider mode, you need to register the SearchClient in the service collection:

// Register SearchClient
services.AddSingleton(sp => 
    new SearchClient(
        new Uri("https://your-search-service.search.windows.net"),
        "your-index-name",
        new DefaultAzureCredential()));

// Add health check
services
    .AddHealthChecks()
    .AddAzureSearch(
        "SearchIndex",
        options =>
        {
            options.Mode = ClientCreationMode.ServiceProvider;
        });

You can also use keyed services for multiple search clients:

// Register keyed SearchClient
services.AddKeyedSingleton("MySearchClient", (sp, key) => 
    new SearchClient(
        new Uri("https://your-search-service.search.windows.net"),
        "your-index-name",
        new DefaultAzureCredential()));

// Add health check with keyed service
services
    .AddHealthChecks()
    .AddAzureSearch(
        "SearchIndex",
        options =>
        {
            options.Mode = ClientCreationMode.ServiceProvider;
            options.KeyedService = "MySearchClient";
        });

Mode: DefaultAzureCredentials

When using the DefaultAzureCredentials mode, the health check will create a SearchClient using the DefaultAzureCredential:

services
    .AddHealthChecks()
    .AddAzureSearch(
        "SearchIndex",
        options =>
        {
            options.ServiceUri = new Uri("https://your-search-service.search.windows.net");
            options.IndexName = "your-index-name";
            options.Mode = ClientCreationMode.DefaultAzureCredentials;
        });

Mode: AzureKeyCredential

When using the AzureKeyCredential mode, the health check will create a SearchClient using the provided API key:

services
    .AddHealthChecks()
    .AddAzureSearch(
        "SearchIndex",
        options =>
        {
            options.ServiceUri = new Uri("https://your-search-service.search.windows.net");
            options.IndexName = "your-index-name";
            options.ApiKey = "your-api-key";
            options.Mode = ClientCreationMode.AzureKeyCredential;
        });

Advanced Configuration

You can configure the SearchClientOptions by providing a configuration action:

services
    .AddHealthChecks()
    .AddAzureSearch(
        "SearchIndex",
        options =>
        {
            options.ServiceUri = new Uri("https://your-search-service.search.windows.net");
            options.IndexName = "your-index-name";
            options.Mode = ClientCreationMode.DefaultAzureCredentials;
            options.ConfigureClientOptions = clientOptions =>
            {
                clientOptions.Retry.MaxRetries = 3;
                clientOptions.Retry.Delay = TimeSpan.FromSeconds(1);
            };
        });

💡 You can always provide tags to all health checks, for grouping or filtering.

var builder = services.AddHealthChecks();

builder.AddAzureSearch("<name>", options => ..., "azure");

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NetEvolve.HealthChecks.Azure.Search:

Package Downloads
NetEvolve.HealthChecks.Azure

Contains HealthChecks for various Azure services.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.13.51 33 3/16/2026
5.13.1 98 3/3/2026
5.11.2 121 1/1/2026
5.10.32 117 12/29/2025
5.9.5 249 12/15/2025
5.8.0 435 12/8/2025
5.7.10 365 12/8/2025
5.5.2 135 11/29/2025
5.0.0 414 11/20/2025