The Atc.Aspire.Azure.Kusto
package provides an Aspire Client Integration for Azure Data Explorer (Kusto), wrapping the Atc.Kusto package. It simplifies integration by providing configuration-driven setup and health checks.
Install the package via NuGet:
dotnet add package Atc.Aspire.Azure.Kusto
Register the Azure Data Explorer client in your Program.cs:
builder.ConfigureAzureDataExplorer("kusto");
This will configure the integration using the ConnectionStrings:kusto entry in your application configuration.
After registration, you can inject IKustoProcessor into your services:
For more information on consuming the IKustoProcessor, refer to the Atc.Kusto documentation.
public class MyService(IKustoProcessor kustoProcessor)
{
public async Task ProcessQueryAsync()
{
var result = await processor.ExecuteQuery(
new TodoQuery(),
cancellationToken);
Console.WriteLine(result);
}
}
Provide the Kusto connection string under ConnectionStrings in your configuration:
{
"ConnectionStrings": {
"kusto": "https://your-cluster.kusto.windows.net"
}
}
Alternatively, configure settings under the Aspire:Kusto:Client section:
{
"Aspire": {
"Kusto": {
"Client": {
"HostAddress": "https://your-cluster.kusto.windows.net",
"DatabaseName": "MyDatabase",
"DisableHealthChecks": false,
"HealthCheckTimeout": 4000
}
}
}
}
You can also configure settings inline when registering the service:
builder.ConfigureAzureDataExplorer("kusto", settings =>
{
settings.DatabaseName = "MyDatabase";
});