Net 4.x迁Net 6时ADOMD.Net认证遇AADSTS50052错误求助
问题:.NET 4.x迁移.NET 6时AdomdClient令牌认证报错AADSTS50052
我正尝试将应用从.NET 4.x迁移至.NET 6,计划把原使用的Microsoft.AnalysisServices.AdomdClient.retail.amd64替换为适配.NET 6的Microsoft.AnalysisServices.AdomdClient.NetCore.retail.amd64,但遇到了异常问题。
报错信息
MsalServiceException: AADSTS50052: The password entered exceeds the maximum length. Please reach out to your admin to reset the password.
复现情况
在.NET 4.x环境中,我依赖Microsoft.Identity.Client的Microsoft.AnalysisServices.AdomdClient.retail.amd64包,通过连接字符串将OnBehalfToken作为Password传入来调用Power BI。使用4.10版本时连接正常,但升级到4.43及以上版本后,就出现了上述“密码过长”的错误。.NET 6对应的包依赖Microsoft.Identity.Client(≥4.43.0),同样存在这个问题。
相关代码
string ConnectionString = $"Provider=MSOLAP;Data Source={server};User ID=;Password={accessToken};Catalog={databaseName};Persist Security Info=True; Impersonation Level=Impersonate"; using (AdomdConnection adomdConnection = new AdomdConnection()) { adomdConnection.ConnectionString = ConnectionString; AdomdCommand adomdCommand = new AdomdCommand(); adomdCommand.Connection = adomdConnection; adomdCommand.CommandText = "SAMPLE QUERY"; adomdConnection.Open(); // 此处抛出AADSTS50052错误 CellSet cellSet = adomdCommand.ExecuteCellSet(); adomdConnection.Close(); }
我无法理解为何旧版本正常,而.NET 4.x新版本及.NET 6全版本均报错,请问是否有其他实现方式或我遗漏了什么关键点?
内容的提问来源于stack exchange,提问作者Bogdan
相关产品推荐
相关产品推荐

