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

Power BI API issue

Hello Team,

              I was looking into using the Power BI API in an effort to automate the distribution of a report we have. Is there any documentation on getting setup to use it? I’ve tried sending a few calls via Postman but receive a 403 forbidden as a response. Guessing I’m not authenticating or authorizing correctly? Can you help me out please? Thank you!

1 ACCEPTED SOLUTION
v-jianpeng-msft
Community Support
Community Support

Hi, @Anonymous 

First of all, you should set the API permissions correctly in Auzre AD and get the correct secret and client ID, which are necessary parameters to get the access token.

Power BI REST APIs for embedded analytics and automation - Power BI REST API | Microsoft Learn

vjianpengmsft_0-1710206942435.png

In the following document, the necessary parameters for requesting an access token are described and the meaning of each parameter is explained:

Understand the OAuth 2.0 authorization code flow in Azure AD - Microsoft Entra | Microsoft Learn

vjianpengmsft_1-1710207394585.png

The 403 forbidden error can be due to two reasons:
1. You have requested the wrong access token, you can use the following two authorization addresses to request a new access token.

Auth URL: https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize
Access Token URL: https://login.microsoftonline.com/organizations/oauth2/token


2. The access token is not set to the request header. The access token should not be in the params in Postman, it should be in the Headers

vjianpengmsft_2-1710208266823.png

The correct access token request for Power BI API results as follows:

vjianpengmsft_8-1710209751266.png

You can learn how to authorize the Power BI API in Azure AD through the following links:

Embed Power BI content in an embedded analytics application with service principal and an application secret - Power BI | Microsoft Learn

vjianpengmsft_3-1710209075282.png

vjianpengmsft_4-1710209101405.png

vjianpengmsft_5-1710209128015.png

You need to enable the API feature in the admin portal of Power BI Service, as shown in the following figure:

vjianpengmsft_6-1710209466246.png

 

vjianpengmsft_7-1710209577454.png

 

The following article is a more detailed tutorial on using the REST API:

Power BI REST API: Step-by-step Guide to Use It | Coupler.io Blog

If the above advice can help you, that's great.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

 

View solution in original post

2 REPLIES 2
v-jianpeng-msft
Community Support
Community Support

Hi, @Anonymous 

First of all, you should set the API permissions correctly in Auzre AD and get the correct secret and client ID, which are necessary parameters to get the access token.

Power BI REST APIs for embedded analytics and automation - Power BI REST API | Microsoft Learn

vjianpengmsft_0-1710206942435.png

In the following document, the necessary parameters for requesting an access token are described and the meaning of each parameter is explained:

Understand the OAuth 2.0 authorization code flow in Azure AD - Microsoft Entra | Microsoft Learn

vjianpengmsft_1-1710207394585.png

The 403 forbidden error can be due to two reasons:
1. You have requested the wrong access token, you can use the following two authorization addresses to request a new access token.

Auth URL: https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize
Access Token URL: https://login.microsoftonline.com/organizations/oauth2/token


2. The access token is not set to the request header. The access token should not be in the params in Postman, it should be in the Headers

vjianpengmsft_2-1710208266823.png

The correct access token request for Power BI API results as follows:

vjianpengmsft_8-1710209751266.png

You can learn how to authorize the Power BI API in Azure AD through the following links:

Embed Power BI content in an embedded analytics application with service principal and an application secret - Power BI | Microsoft Learn

vjianpengmsft_3-1710209075282.png

vjianpengmsft_4-1710209101405.png

vjianpengmsft_5-1710209128015.png

You need to enable the API feature in the admin portal of Power BI Service, as shown in the following figure:

vjianpengmsft_6-1710209466246.png

 

vjianpengmsft_7-1710209577454.png

 

The following article is a more detailed tutorial on using the REST API:

Power BI REST API: Step-by-step Guide to Use It | Coupler.io Blog

If the above advice can help you, that's great.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

 

lbendlin
Super User
Super User

Please be more specific.  Do you want to distribute the pbix, do you want to extract data, do you want to render the report into PPT or PDF, or do you want to manage subscriptions?

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.

Jan NL Carousel

Fabric Community Update - January 2025

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