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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
IainColledge
New Member

Unable to access any Power BI API using VSCode Rest Client without getting a 403 error

Hi,

 

I would be greatful for any help on a problem we have, we're wanting to use Power BI Embedded but to prototype the calls we're using the Rest Client extension in VSCode. 

We have a service principle set up, this successful calls the APIs under graph.microsoft.com and management.azure.com by getting an azure AD V2 token.

 

This service principle will not be using delegated authorisation. It's been set up in a security group (PowerBiGroup) as per instructions.

Under Power BI we have a PPU user as an admin user and in the Power BI admin portal they have enabled:

 

  • Tenant settings -> Developer -> Embed content in apps -> PowerBiGroup
  • Tenant settings -> Developer -> Service principles can use Fabric APIs -> PowerBiGroup
  • Tenant settings -> Developer -> Allow service principals to create and use profiles -> PowerBiGroup
  • Tenant settings -> Admin API settings -> Service principals can access read-only admin APIs -> PowerBiGroup

There is a workspace and the PowerBiGroup have been added as an admin.

 

Despite these settings I can auth fine, get a bearer token but every API call I make fails with a 403, I've tried:

 

Using the format:

GET https://api.powerbi.com/v1.0/myorg/groups
Authorization: bearer {{$aadV2Token appOnly}}

Apart from the MS documentation and various posts out there I've also watched this tutorial https://www.youtube.com/watch?v=3RidKdK2KOM as well as cloned the github repo to show various calls.

Please can anoyone help as this is very frustrating as we eventually want to use Power BI embedded for customers but have spent a long time trying to get service principles to work in any capacity.

 
1 ACCEPTED SOLUTION
IainColledge
New Member

Found the problem:

 

GET https://api.powerbi.com/v1.0/myorg/groups
Authorization: bearer {{$aadV2Token appOnly}}

 

Should be:

 

GET https://api.powerbi.com/v1.0/myorg/groups
Authorization: Bearer {{$aadV2Token appOnly}}

 

The other Azure REST APIs don't complain with using "bearer", the Power BI APIs fail without "Bearer".

View solution in original post

4 REPLIES 4
IainColledge
New Member

Found the problem:

 

GET https://api.powerbi.com/v1.0/myorg/groups
Authorization: bearer {{$aadV2Token appOnly}}

 

Should be:

 

GET https://api.powerbi.com/v1.0/myorg/groups
Authorization: Bearer {{$aadV2Token appOnly}}

 

The other Azure REST APIs don't complain with using "bearer", the Power BI APIs fail without "Bearer".

IainColledge
New Member

Power BI studio works with a local Power BI user.

Delegated API calls work as well.

lbendlin
Super User
Super User

Thank you, that is something to look at, even just to see APIs are accessible.

This is more about how to learn the API behavior so we can automate later in an app etc.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.