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
absmiths
Regular Visitor

Access Datasets using PowerBI REST API from Java

I am trying to access the rest API to refresh a dataset, and I am running into authorization problems.  I need to use an app registration from azure.  I create an Authorization context with my client Id and secret, which works with other azure services, but whatever I do I just get unauthorized.  Here are the details:

 

I have assigned permissions in Azure AD to allow Power BI Service (Power BI), including 'Read and Write all Datasets' and 'View all Datasets'.  When I try to access this rest endpoint, https://api.powerbi.com/v1.0/myorg/datasets, I just get unauthorized.  Am I missing a step here?  I think I need to use this call first so that I can get the guid of the dataset to refresh.

3 REPLIES 3
ausgod
New Member

Was there a resultion for this issue.   I am having the exact same problem.  All documented access has been given and still get unauthorized 

v-micsh-msft
Employee
Employee

You need to give the App the corresponding permission to access Power BI resources:

Follow the steps below:

Register an Azure AD app to embed Power BI content

https://docs.microsoft.com/en-us/power-bi/developer/register-app

 

Follow the Through Azure Portal part.

 

Regards,

Michael

I went through those steps a couple of different times, and it hasn't worked.  I have tried creating a user using the pbi developer access page and using the azure ad portal directly.  I still only get an 'Unauthorized' response.

 

One part I can't follow is granting the AD permission "Access the directory as the signed in user".  My org prohibits this but it doesn't seem necessary anyway since I am not doing impersonation.  Also, in my case I am using a web API instead of a native application type.  Is this required for accessing the dataset refresh API?

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.