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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Anonymous
Not applicable

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

Anonymous
Not applicable

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.