Forum Discussion
Embedded paginated report with PowerBI dataset
In Feb the option of using a Power BI dataset was introduced for embedded paginated reports.
I understand the requirement is slightly different in that you need to now pass the datasetId as well as xmlaPermissions as described here
https://docs.microsoft.com/en-gb/rest/api/power-bi/embed-token/generate-token
I have 2 questions based on this, firstly is there a way to extract the datasetId from a report? If I open the RDL file in a text editor I can see it in there, can this be obtained programatically to then use in a request for the token?
The second part is, if possible, is there a code example of this being used? The github examples (linked below) do not seem to show this scenario yet. I intend to use the PowerBIClient from the Microsoft.PowerBi.APi nuget.
Hi JAnder ,
The way I am using for obtaining the dataset ID programatically is by calling "Reports - Get Datasources" API https://docs.microsoft.com/en-gb/rest/api/power-bi/reports/get-datasources-in-group the datasource representing the Power BI Dataset will have in the ConnectionDetails.Database something like
sobe_wowvirtualserver-<DatasetID> .Regarding code sample, I don't think there's a code sample for this specific case, but any sample for embedding RDL report should work, besides the change in generateToken request which should look similar to this:I posed a code sample here that shows how to get the embed token using the Microsoft.PowerBi.APi nuget: Solved: Re: Paginated Report embedding using a Power BI Da... - Microsoft Power BI Community
12 Replies
- MichaelWashHelper I
JAnder - For var identities I must pass a new EffectiveIdentity even if I was not using Row Level Secuity like this:
var identities: new List<EffectiveIdentity> { // This first EffectiveIdentity is needed only if // the Dataset uses Row Level Security new EffectiveIdentity( username: "[email protected]", roles: new List<string> { "A Role" }, datasets: new List<string> { datasetId.ToString() } ), new EffectiveIdentity( username: "[email protected]" , reports: new List<string> { reportId.ToString() } ) }- JAnderHelper II
I found that looking at the request on Fiddler gives more info that the exception shows. It actually didn't want my effective identity at all. I took out the identity and got the token.
{ "error": { "code": "InvalidRequest", "message": "Creating embed token for accessing dataset <removed> shouldn't have effective identity" } }- MichaelWashHelper I
Can you show me your code?
- AmosHerschMicrosoft Employee
Hi JAnder ,
The way I am using for obtaining the dataset ID programatically is by calling "Reports - Get Datasources" API https://docs.microsoft.com/en-gb/rest/api/power-bi/reports/get-datasources-in-group the datasource representing the Power BI Dataset will have in the ConnectionDetails.Database something like
sobe_wowvirtualserver-<DatasetID> .Regarding code sample, I don't think there's a code sample for this specific case, but any sample for embedding RDL report should work, besides the change in generateToken request which should look similar to this:- JAnderHelper II
Thanks AmosHersch for the info. Much appreciated.
- MichaelWashHelper I
I posed a code sample here that shows how to get the embed token using the Microsoft.PowerBi.APi nuget: Solved: Re: Paginated Report embedding using a Power BI Da... - Microsoft Power BI Community