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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
lurbanek
New Member

authorisation with user principal to REST API

I have issues with using the REST API with User Principal. Let me share the issue with you.

1. I'm getting the access token from here:
https://login.microsoftonline.com/<instance_id>/oauth2/token, providing client_id, resource ("https://analysis.windows.net/powerbi/api"), client_secret and grant_type ("user_credentials").

2. With this token I can access the "Admin" part of the REST API:
https://api.powerbi.com/v1.0/myorg/admin/<anything>

3. But I can't access other parts of the REST API, receiving "403 Forbidden" (ie. here: https://api.powerbi.com/reports/api/v2.0/myorg/me)
4. In particular I'm interested in using the part of API described here: https://learn.microsoft.com/en-us/rest/api/power-bi/datasets

What am I missing here? 
Do I need to create other type of access token?
Do I miss some configuration?

 

thank you in advance for any help

1 REPLY 1
Anonymous
Not applicable

Hey @lurbanek you are app is probably missing the right scopes. As you can see in the documentation (for instance Datasets - Get Dataset - REST API (Power BI Power BI REST APIs) | Microsoft Learn) each request has a required scope. In the example above the required scopes are Dataset.ReadWrite.All or Dataset.Read.All.

 

You need to set up these scopes for the application you registered in AD (you are already using the client_id and client_secret of this application when requesting a token. If you do not know how to do it, you can follow Step 2 - Register Application,  of this guide: Get started with Power BI Embedded - Power BI | Microsoft Learn.

 

Let me know if this solve your problem 🙂

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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