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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Access token lacks authorisation

Hello troops, I am trying to develop an Azure application with PowerBI embedded.

 

I am currently stuck at the point of making an API call to get an access_token that will allow me to push a dataset in a specific group.

 

I have been looking for hours and I was unable to find a solution that allows me to do so.

 

So far, I have managed to create an  API on Azure and give that API all the possible Power BI Service permissions (See photo below)

 

Screenshot 2021-07-13 at 17.00.40.png

 Furthermore, what I think I am doing via postman is reaching out to that API and getting validated, as you will see in the next picture

 

Screenshot 2021-07-13 at 17.05.59.png

 

This returns an access_token back, however, this token does not have any permissions as far as I can tell. I have tried getting reports, datasets, dashboards but to no avail. 

 

If anyone could give me some help here I would very much appreciate it!

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

Hi @Anonymous 

There may be something wrong to your access token.

Could your tell me which kind of your Azure App is, app owns data or user owns data?

There are two kind of authentication method for app owns data, service principle or master user?

I see in your Body you have password and username, if you use user owns data or master user, please use Password in grant_type, if you use service principle , use client_credentials in grant_type.

From your screenshot of API Permission, I find that your didn't grant admin consent for you permissions.(App owns data —— Master user or user owns data need this.)

1.png

API Permission configured correctly looks like as below.

2.png

Then please check your api resouce, the resource url should be  https://analysis.windows.net/powerbi/api .

 

Best Regards,

Rico Zhou

 

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

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

There may be something wrong to your access token.

Could your tell me which kind of your Azure App is, app owns data or user owns data?

There are two kind of authentication method for app owns data, service principle or master user?

I see in your Body you have password and username, if you use user owns data or master user, please use Password in grant_type, if you use service principle , use client_credentials in grant_type.

From your screenshot of API Permission, I find that your didn't grant admin consent for you permissions.(App owns data —— Master user or user owns data need this.)

1.png

API Permission configured correctly looks like as below.

2.png

Then please check your api resouce, the resource url should be  https://analysis.windows.net/powerbi/api .

 

Best Regards,

Rico Zhou

 

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

 

Anonymous
Not applicable

Thanks for your reply @v-rzhou-msft. Indeed the problem was with the authorisation token, I contacted my administrator and asked him to grant permissions to the token. It now works flawlessly!

I am still not able to resolve my issue, could you tell me what all permissions did you give in Azure direcotry and also how are you calling the post method to request for the token? In my case i have client secret , how to request access token without providing username and password

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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