PowerBI Embedded "Provision Token" 生成错误

PowerBI Embedded "Provision Token" generation error

我正在尝试关注 this PowerBI embedded example,但遇到错误:

'PowerBIToken' does not contain a definition for 'CreateProvisionToken'

This MSDN article 描述了 CreateProvisionToken() 方法。

我还尝试将 CreateProvisionToken() 部分更改为以下内容:

var credentials = new TokenCredentials(accessKey, "AppKey");

var client = new PowerBIClient(credentials);

var devToken = PowerBIToken. CreateDevToken(reportID, workspaceID);
using (client)
{
    var embedToken = PowerBIToken.CreateReportEmbedToken(
        collectionName, 
        workspaceID, 
        reportID);
    var embedTokenString = embedToken.Generate(accessKey);
}

它生成了一个令牌"looks about right",但是在文章末尾的示例html中使用这个令牌导致在呈现报告时出现错误This content is not available

我错过了什么?

最新版本的 Power BI embedded 通过仅支持一个嵌入式令牌简化了身份验证机制,不再支持 Power BI 博客中的其他令牌:

https://powerbi.microsoft.com/en-us/blog/what-s-new-and-what-s-next-for-power-bi-embedded-july-2016/

We have simplified the way developers authenticate their calls to Power BI. From today on, app tokens will only be used to authenticate embedding requests and other client side requests that may be added in the future. All calls to our REST APIs will be authenticated using our API keys directly. This eliminates the need to generate app tokens each time you want to call the REST API.

你需要跟进微软的例子:

https://github.com/Azure-Samples/power-bi-embedded-integrate-report-into-web-app/blob/master/EmbedSample/Controllers/DashboardController.cs