Kustos connection string problem in .NET Core

Viewed 1536

I want to access a Kusto database without hardcoding password or any application key. It's working perfectly with .NET Framework. Following is the code.

var serviceName = "help";
var authority = "contoso.com"; // Or the AAD tenant GUID: "..."
var kustoConnectionStringBuilder = new KustoConnectionStringBuilder($"https://{serviceName }.kusto.windows.net")
{
    FederatedSecurity = true,
    InitialCatalog = "samples",
    Authority = authority,
};

However, in .NET Core I get the below error for the same connection string.

$exception {"Kusto Connection String Builder has some invalid or conflicting properties: Specified 'AAD Username password' authentication method has some incorrect properties. Missing: [User ID,Password].. ',\r\nPlease consult Kusto Connection String documentation at https://docs.microsoft.com/en-us/azure/kusto/api/connection-strings/kusto"} Kusto.Data.Exceptions.KustoClientInvalidConnectionStringException

What are my alternatives for .NET Core apps?

1 Answers

If you’re using .NET Core and want to perform user authentication, please set the following properties on KustoConnectionStringBuilder:

  1. UserID
  2. Password
  3. Federated=true

The .NET Core library doesn’t support prompting users for their credentials, so this needs to be provided up front.

Related