Forum Discussion

stephan_'s avatar
stephan_
Regular Visitor
4 months ago
Solved

Cannot retrieve Contacts from API

I have the following code:

(With url and url2 I get the exact same error). The SPN I am using is Power BI Admin, has Tenant.ReadWrite.All, Report.Read.All & Workspace.Read.All. Its role also has permissions on the "Service principals can access read-only Admin APIs" setting in Power BI Tenant Settings. And this works for almost all APIs, but not this one. Is there something else I should do to get this API to work? Or does this API only work with user accounts and not SPNs?

8 Replies

Replies have been turned off for this discussion
  • Hi stephan_ 

     

    I am not completely certain, but based on the 403 error and the message “API is not accessible for application”, this behaviour is expected for this specific endpoint.

    The endpoint
    GET /v1.0/myorg/reports/{reportId}/contacts
    does not support application-only authentication (service principal / client credentials). It requires a delegated user context, meaning it works only when authenticated with a user account and not with a service principal.

    This is not a missing permission issue. Even with permissions such as Tenant.ReadWrite.All, Report.Read.All, and Workspace.Read.All, the endpoint remains inaccessible because it is not designed to work with application tokens. The error message clearly indicates that the API is restricted to user-based authentication.

    In addition, Microsoft has not published an official Power BI REST API to retrieve the report contact list configured in the Power BI Service user interface. This confirms that the endpoint is either internal or UI-related and therefore unsuitable for automation with service principals.

     

    Recommended Alternatives

    1. Governance and access control

      • Use Admin APIs such as Get Report Users as Admin or tenant scan endpoints.

      • These APIs are supported with service principals and provide information about who has access to reports, which is usually sufficient for governance and ownership tracking.

    2. Operational workaround

      • Maintain report contact ownership in an external metadata store (for example, SharePoint, Dataverse, or SQL).

      • Populate this store using supported REST APIs (such as listing reports per workspace) and manage contacts as governed metadata rather than relying on the UI contact list.

     

  • stephan_ 

    I could not find this endpoint in power bi api documentation or in fabric api documentation 

    GET /v1.0/myorg/reports/{reportId}/contacts

     

    From the screenshot you shared I believe you found this API in network traces. Please correct me if I am wrong. 

     

    I believe you are trying to extract the report contacts by running this API call. Its hard to identify the supported authentication mechanisms for the APIs which are not exposed by Microsoft in their docuementation. 

     

    I also checked the GetReportUsersAsAdmin and GetReportsAsAdmin API none of these APIs expose "report contact" details. If you check this recent thread, in that Community team has confirmed that this detail is not exposed in any API

    https://community.fabric.microsoft.com/t5/Service/Owner-Contact-Field-on-reports/m-p/4927085

     

    You can post this idea in Fabric ideas forum

    https://community.fabric.microsoft.com/t5/Fabric-Ideas/idb-p/fbc_ideas

     

     

     

     

    Connect on LinkedIn

    read my blogs here: techietips.co.in

     

     








    Did I answer your question? Mark my post as a solution!
    If I helped you, click on the Thumbs Up to give Kudos.

    Proud to be a Super User!