.NET Core 中的 Kustos 连接字符串问题 [英] Kustos connection string problem in .NET Core

查看:25
本文介绍了.NET Core 中的 Kustos 连接字符串问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在没有硬编码密码或任何应用程序密钥的情况下访问 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:

  1. 用户ID
  2. 密码
  3. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆