Forum Discussion
Power Bi Rest Api App Endpoints
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,
- Jai-Rathinavel1 year agoSuper User
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