Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
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
Hi @s13711 ,
There are several documents post on how to work around this problem.
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 4 | |
| 3 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 |