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

查看:145
本文介绍了.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,密码] ..',\r\n请查阅 https://docs.microsoft.com/zh-cn/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].. ',\r\nPlease 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. 用户名

  2. 密码

  3. Federated = true

  1. UserID
  2. Password
  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天全站免登陆