gpt4 book ai didi

powerbi - 在没有访问 token 的情况下显示 Power BI 报告?

转载 作者:行者123 更新时间:2023-12-04 01:47:30 25 4
gpt4 key购买 nike

亲爱的,我正在根据用户选择的过滤条件显示 PBI 报告。为了显示报告,我在 C# 中使用 Microsoft Power BI API。它工作正常但突然开始给我以下错误:

You have exceeded the amount of embed token that can be generated on a shared capacity. You need to purchase Azure capacities to generate embed tokens. See https://go.microsoft.com/fwlink/?linkid=868976\

using (var powerBiClient = new PowerBIClient(new Uri(apiUrl), tokenCredentials))
{
var reports = powerBiClient.Reports.GetReportsInGroupAsync(groupId).GetAwaiter().GetResult();
var report = reports.Value.FirstOrDefault(rep => rep.Id == reportId);
var datasets = powerBiClient.Datasets.GetDatasetByIdInGroupAsync(groupId, report.DatasetId).GetAwaiter().GetResult();
var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
var tokenResponse = powerBiClient.Reports.GenerateTokenInGroupAsync(groupId, report.Id, generateTokenRequestParameters).GetAwaiter().GetResult();
}

我在最后一行遇到错误(即 GenerateTokenInGroupAsync)。为了解决这个问题,建议获得 PBI Pro 许可证,但在我的情况下这是不可能的。所以有人可以推荐我任何其他方式来完成我的工作,而不是发布到 Web 并获取嵌入式 URL,因为我需要根据用户选择过滤报告。

我可以在没有访问 token 的情况下访问和显示报告,或者在没有 Pro 许可证的情况下获取 token 吗?

最佳答案

这不是关于 Pro 许可证,而是关于 Premium。您已经拥有专业版,否则您将无法使用组(工作区),这是专业版的唯一功能(尽管它可能只是试用版)。然而,GenerateTokenInGroup与高级容量有关。如果没有为您的工作区分配容量,您可以生成的 token 数量有限。参见 Create a dedicated capacity :

Using embed tokens with PRO licenses are intended for development testing, so the number of embed tokens a Power BI master account or service principal can generate is limited. A dedicated capacity requires embedding in a production environment. There's no limit on how many embed tokens you can generate with a dedicated capacity.

因此,您在没有分配专用容量的情况下投入生产,并且达到了可以生成的 token 的限制。您必须购买 Power BI Premium 容量并将其分配给此工作区(这将允许您在不更改代码的情况下继续操作),或者根本停止使用嵌入式 token 。

您可以改用 AAD token 。在embedConfigurationtokenType 更改为 TokenType.AAd并使用从 ADAL 的 AcquireTokenAsync 方法获得的 token (用于构建传递给 PowerBIClient 的构造函数的 tokenCredentials 的 token )。

关于powerbi - 在没有访问 token 的情况下显示 Power BI 报告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54668773/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com