Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am trying to interact with an App on a workspace using a service principal. The documentation states that service principals are not allowed. https://learn.microsoft.com/en-us/rest/api/power-bi/apps/get-reports
I have two questions:
I am trying to interact with an App on a workspace using a service principal.
Interact how? For what purpose?
I want to use the power bi rest api to query the app to get the lists of reports. I would like to not use a username and password to retrieve a token to do this.
That's not something you do with the app. You need to call the Group/Workspace endpoint for that.
I understand that and we do that for other use cases. However, this use case is to only get reports that are associated to an app. I'd also like to leverage a service principal to call the api endpoint.
I understand this functionality is not allowed and I am very interested to know why. As I said before, people are assigning an admin user to the app and using their credentials to retreive information about the app. That seems like a very bad practice and I am curious to know why this is the accepted route.
I am of the opposite opinion. I consider service principals to be "very bad practice" as you completely lose the auditability. You will have no idea who to yell at when things go pear shaped.
The service principal is merely polling from an app. There is nothing that could go pear shaped because the only authorization bit you can assign is read access to a service principal. Users, who are viewing the app's reports in a different form on a website, have their own RLS, permissions, and identity management with auditing invovled. I am not interested in leaking a credential that could risk PHI loss.
I'm trying to understand why a service principal cannot access a domain's endpoints. I have found,
Hi @jmoore11 , If you have access to fabric trial / fabric capacity and an admin user. You can run this piece of code in your fabric notebook and store it in a lakehouse and further clean the data to get the list of reports mapped to their respective apps.
No Service principal is needed and credentials are not exposed in this approach but the user who is running this code should be a Power BI Admin . The App ID will be present in web url column of the json response. I have used sempy library which is an official library released by Microsoft
import sempy.fabric as fabric
client = fabric.FabricRestClient()
reports_url = "v1.0/myorg/admin/reports?$top=5000"
reports_json = client.get(reports_url).json()
apps_url = "v1.0/myorg/admin/apps?$top=5000"
apps_json = client.get(apps_url).json()
Thanks,
Jai
Proud to be a Super User! | |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 |