Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
s13711
New Member

Power Bi data protection - Access Token per report

Hi all,

 

I am using Power BI REST API and I am building an application that will pass the access token and embedUrl for the selected report. The data is downloaded automatically by the master user who has access to all reports. Clients can only view reports made available by master user.

One of the requirements is that the end-user (client) must have access only to the submitted report. In other words, modifying embedUrl should not allowed user to get access to another report / workspace.

From what I noticed, my implementation of getting access token gives access to all reports. Can it be changed so that the access token is per report or at least workspace?


Language C#

var tenantId = ...
var clientId = ...
var clientSecret = ...

var username = ...
var password = ...
var resource = "https://analysis.windows.net/powerbi/api";

var client = new RestClient($"https://login.microsoftonline.com/{tenantId}/oauth2/token");
var request = new RestRequest(Method.POST);

request.AddParameter("username", username, ParameterType.GetOrPost);
request.AddParameter("password", password, ParameterType.GetOrPost);
request.AddParameter("client_secret", clientSecret, ParameterType.GetOrPost);
request.AddParameter("client_id", clientId, ParameterType.GetOrPost);
request.AddParameter("resource", resource, ParameterType.GetOrPost);
request.AddParameter("grant_type", "password", ParameterType.GetOrPost);

var response = client.Execute(request);



My program is based on Power-Bi-Samples / .NET Core / Embed for your organisation

https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/.NET%20Core/Embed%20for%20your%20...

Thanks in advance for your help

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @s13711 ,

 


Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it.

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @s13711 ,


There are several documents post on how to work around this problem.

https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-your-organization?tabs...

https://docs.microsoft.com/en-us/power-bi/developer/automation/walkthrough-push-data-get-token

https://docs.microsoft.com/en-us/power-bi/developer/embedded/generate-embed-token

https://guyinacube.com/2019/04/04/easily-get-an-access-token-for-the-power-bi-embedded-playground/


Please check if this could meet your requirements.😀

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.