Package reference page maintained from the source documentation in src/HealthChecks.Azure.IoTHub.

Azure IoT Hub Health Check

This health check verifies the ability to communicate with Azure IoT Hub. For more information about Azure IoT Hub please check and .NET please check the Azure IoT Hub Microsoft Site

Defaults

You can use RegistryManager or ServiceClient or both. It's recommended to have a single instance per application, so prefer the type you already use.

public void ConfigureServices(IServiceCollection services)
{
    services
        .AddSingleton(sp => ServiceClient.Create("iot-hub-hostname", new DefaultAzureCredential()))
        .AddHealthChecks()
        .AddAzureIoTHubServiceClient();

    // or

    services
        .AddSingleton(sp => RegistryManager.Create("iot-hub-hostname", new DefaultAzureCredential()))
        .AddHealthChecks()
        .AddAzureIoTHubRegistryReadCheck();
}

Customization

With all of the following examples, you can additionally add the following parameters:

AddAzureIoTHubServiceClient

AddAzureIoTHubRegistryManager