The Atc.Aspire.Hosting.Azure.Kusto
package provides an Aspire Hosting Integration for running Azure Data Explorer (Kusto Emulator) containers within a .NET Aspire distributed application. It enables easy setup of Kusto instances with health checks, connection string handling, and default configurations.
Install the package via NuGet:
dotnet add package Atc.Aspire.Hosting.Azure.Kusto
Register a Kusto emulator container in your AppHost's Program.cs:
var builder = DistributedApplication.CreateBuilder(args);
var kusto = builder.AddKustainer("kusto-emulator");
builder.Build().Run();
This will configure the emulator with a default HTTP port and include it in your distributed application.
If your service needs access to the emulator, reference it in your project:
var myService = builder.AddProject<Projects.MyService>().WithReference(kusto);
Your MyService project can now resolve the Kusto connection string automatically.
By default, the emulator runs on port 8080. You can override this by specifying a custom port:
var kusto = builder.AddKustainer("kusto-emulator", httpPort: 9090);
To persist data across container restarts, you can attach a named volume:
kusto.WithDataVolume();
Alternatively, specify a custom volume name:
kusto.WithDataVolume("my-kusto-data");
The emulator includes built-in health checks. These are automatically added but can be configured if needed:
builder.Services.AddHealthChecks()
.AddCheck<KustoHealthCheck>("kusto_check");