Forum Discussion
Creating a report using MS API call on PBI Service
- 2 months ago
Thankyou, na12063, oussamahaimoud and tayloramy for your responses.
Hi jight,Based on our understanding, the issue may be related to the authentication pattern currently being used inside Power Query. The access token is being dynamically generated within the M query using Service Principal credentials and is then passed into the Web.Contents() function.
Since you already have Fabric capacity available, one possible approach would be to use a Fabric Notebook or Data Pipeline, or an Azure Function or Logic App to handle the Service Principal authentication and Power BI REST API calls externally. The results can then be stored in a Lakehouse or Warehouse table. After that, you can connect Power BI to the stored data instead of calling the REST API directly from Power Query.
For refresh monitoring, you can use APIs such as the Get Refresh History API. Additionally, tenant wide monitoring APIs require Power BI or Fabric admin permissions, whereas workspace level APIs can still work provided the Service Principal has access to those workspaces and the required API permissions have been granted.
Please refer to the links below for further reference:
Datasets - Get Refresh History - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Power BI REST APIs for embedded analytics and automation - Power BI REST API | Microsoft Learn
Embed Power BI content in an embedded analytics application with service principal and an application secret - Power BI | Microsoft LearnWe hope the information provided helps resolve the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.
- 2 months ago
Hi jight,
I would recommend first using a notebook to get all the data you care about in one place, and then report off of it.
FIrst you can list all the items in a workspace using the list items endpoint:
https://learn.microsoft.com/en-us/rest/api/fabric/core/items/list-items?tabs=HTTP
Then you can filter the response to only datasets, and from there you can get the refresh history:
https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/get-refresh-historyOnce you have this data all in a table, then building the report in power bi is easy.
Hi jight,
We are following up to see if what we shared solved your issue. If you need more support, please reach out to the Microsoft Fabric community.
Thank you.
Hi,
Thanks for following it up. I'm still stuck unfortunately.
Ideally, I would extract these data directly from using our admin account but the access is limited to our IT team only.
The method that works on Desktop doesn't work on our work PBI server and we can't install things randomly on our organisation machines.