在没有访问令牌的情况下显示 Power BI 报告?
Display Power BI Reports without access token?
亲爱的,
我正在根据用户选择的过滤条件显示 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 因为我需要根据用户选择过滤报告。
我可以在没有访问令牌的情况下访问和显示报告,或者在没有 Pro 许可证的情况下获取令牌吗?
这不是关于 Pro 许可证,而是关于 Premium。您已经拥有专业版,否则您将无法使用组(工作区),这是专业版的唯一功能(尽管它可能只是试用版)。但是,GenerateTokenInGroup is something related to Premium capacities. Without capacity assigned to your workspace, you have a limited number of tokens, that you can generate. See 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.
所以你在没有分配专用容量的情况下投入生产,并且达到了可以生成的令牌的限制。您必须购买 Power BI Premium 容量并将其分配给此工作区(这将允许您在不更改代码的情况下继续操作),或者根本停止使用嵌入式令牌。
您可以改用 AAD 令牌。在 embedConfiguration change tokenType
to be TokenType.AAd
中并使用从 ADAL 的 AcquireTokenAsync
方法中获得的令牌(用于构造 tokenCredentials
的令牌传递给 PowerBIClient
的构造函数)。
亲爱的, 我正在根据用户选择的过滤条件显示 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 因为我需要根据用户选择过滤报告。
我可以在没有访问令牌的情况下访问和显示报告,或者在没有 Pro 许可证的情况下获取令牌吗?
这不是关于 Pro 许可证,而是关于 Premium。您已经拥有专业版,否则您将无法使用组(工作区),这是专业版的唯一功能(尽管它可能只是试用版)。但是,GenerateTokenInGroup is something related to Premium capacities. Without capacity assigned to your workspace, you have a limited number of tokens, that you can generate. See 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.
所以你在没有分配专用容量的情况下投入生产,并且达到了可以生成的令牌的限制。您必须购买 Power BI Premium 容量并将其分配给此工作区(这将允许您在不更改代码的情况下继续操作),或者根本停止使用嵌入式令牌。
您可以改用 AAD 令牌。在 embedConfiguration change tokenType
to be TokenType.AAd
中并使用从 ADAL 的 AcquireTokenAsync
方法中获得的令牌(用于构造 tokenCredentials
的令牌传递给 PowerBIClient
的构造函数)。