.NET Core 中的 Kustos 连接字符串问题 [英] Kustos connection string problem in .NET Core
问题描述
我想在没有硬编码密码或任何应用程序密钥的情况下访问 Kusto 数据库.它与 .NET Framework 完美配合.以下是代码.
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,
};
但是,在 .NET Core 中,对于相同的连接字符串,我收到以下错误.
However, in .NET Core I get the below error for the same connection string.
$exception {"Kusto 连接字符串生成器有一些无效或冲突的属性:指定的AAD 用户名密码"身份验证方法有一些不正确的属性.缺少:[用户 ID,密码]..", 请咨询 Kusto 连接https://docs.microsoft.com 上的字符串文档/en-us/azure/kusto/api/connection-strings/kusto"} Kusto.Data.Exceptions.KustoClientInvalidConnectionStringException
$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].. ', Please consult Kusto Connection String documentation at https://docs.microsoft.com/en-us/azure/kusto/api/connection-strings/kusto"} Kusto.Data.Exceptions.KustoClientInvalidConnectionStringException
.NET Core 应用程序有哪些替代方案?
What are my alternatives for .NET Core apps?
推荐答案
如果您正在使用 .NET Core 并希望执行用户身份验证,请在 KustoConnectionStringBuilder
上设置以下属性:
If you’re using .NET Core and want to perform user authentication, please set the following properties on KustoConnectionStringBuilder
:
用户ID
密码
Federated=true
.NET Core 库不支持提示用户输入凭据,因此需要预先提供.
The .NET Core library doesn’t support prompting users for their credentials, so this needs to be provided up front.
这篇关于.NET Core 中的 Kustos 连接字符串问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!