【发布时间】:2019-03-25 23:24:27
【问题描述】:
我是 Power BI API 的新手,我通过以下链接将 Power BI 报告嵌入到使用 .NETSDK 的网站中。
我是 Azure Active Directory 用户,我已使用我的 Active Directory 帐户下载了 Power BI。我按照embedding setup tool 将应用程序设置为本地用户并获取用于 API 调用的应用程序 ID。我的一位团队成员设计了一份 Power BI 报告并发布了与我共享的工作区。我的 AuthenticationType 是 MasterUser。 如上述教程中所述,我下载了 GitHub 中提供的示例应用程序。我已成为我的 power BI pro 帐户的管理员,并尝试将报告集成到网站中。我按照教程中的描述替换了凭据和其他 ID。但这给了我以下错误-
unknown_user_type:未知用户类型
这是在 AquireTokenAsync 调用期间失败的代码。
private async Task<AuthenticationResult> DoAuthentication()
{
AuthenticationResult authenticationResult = null;
if (AuthenticationType.Equals("MasterUser"))
{
var authenticationContext = new AuthenticationContext(AuthorityUrl);
// Authentication using master user credentials
var credential = new UserPasswordCredential(Username, Password);
authenticationResult = authenticationContext.AcquireTokenAsync(ResourceUrl, ApplicationId, credential).Result;
}
return authenticationResult;
}
请帮我解决这个问题。提前致谢。
【问题讨论】:
-
我们可以看看一些代码吗?
-
我正在使用github.com/Microsoft/PowerBI-Developer-Samples提供的示例应用程序
-
@Greg 我已将这段代码添加到我的问题中。
标签: c# azure powerbi powerbi-embedded