Forum Discussion

jp_golay's avatar
jp_golay
Helper III
6 months ago
Solved

Fabric Rest Api

Hi we use Fabric Rest API for a tool creating Backup and MCP around Power BI items. We need to use a service principal as we are in a backend task, but surprisingly we are not able to scan the perso...
  • Jai-Rathinavel's avatar
    6 months ago

    Hi jp_golay , There are APIs available in the Power BI Rest API Documentation to extract artifacts metadata from personal workspaces as well. You would have to use the below four APIs hand in hand to achieve that. 

     

    Rest API Documentation: https://learn.microsoft.com/en-us/rest/api/power-bi/admin

     

    Please note that the below APIs require admin access to the Service principal. Make sure service principal can access Admin APIs by configuring the Admin portal settings.


    Thanks,

    Jai

  • MohdZaid_'s avatar
    6 months ago

    Hey jp_golay  , 

     

    In Microsoft Fabric and Power BI, service principals cannot access personal (“My workspace”) workspaces by default, and this is largely by design for privacy and compliance reasons. Standard Fabric REST APIs will not return personal workspaces when called by a normal service principal. However, governance access is possible through the Power BI Admin REST APIs, not the regular APIs.

     

    If the service principal is added to a security group that has Power BI Service Admin or Fabric Admin rights, and tenant settings allow service principals to use Power BI APIs, then the Admin workspace scan endpoints (with the includePersonalWorkspaces flag enabled) can retrieve metadata for personal workspaces. For compliance and monitoring, organizations can also use Microsoft 365 audit logs and optionally Microsoft Purview. There is no supported way for a non-admin service principal to fully enumerate personal workspaces, so the practical solution is to use an admin-level service principal combined with Admin APIs and audit logging.

  • Nasif_Azam's avatar
    6 months ago

    Hey jp_golay ,

    This is a confirmed by-design limitation. Microsoft explicitly states "My Workspace isn't supported when using service principal." However, the situation is not completely hopeless. Here are some workarounds available:

     

    Workaround-1: Admin APIs DO Return Personal Workspace Metadata (via Service Principal)

    Even though you can't access content via service principal, you can discover and scan personal workspaces:

    • GET /v1.0/myorg/admin/groups?$top=5000 which returns personal workspaces as type PersonalGroup
    • Scanner/WorkspaceInfo API (/v1.0/myorg/admin/workspaces/getInfo) which can scan personal workspaces for deeper metadata (reports, datasets, lineage, datasource details)
    • Both support service principal authentication when "Admin API Settings > Service principals can access read-only admin APIs" is enabled

     

    Workaround-2: Delegated Admin Token for Full Content Backup

    For actual content backup (export .pbix, definitions, etc.), replace the service principal with a Fabric Admin delegated user account:

    • Fabric Admin calls Admin Portal > Workspaces > "Get Access" on target personal workspaces (this can be done via API: POST /v1.0/myorg/admin/groups/{groupId}/users to add the admin user)
    • Once the admin user has access, use delegated token (OAuth authorization_code flow) to call export APIs against those personal workspaces
    • Automate token refresh using a secured service account with Fabric Admin role

     

    Workaround-3: Prevent the Problem with Governance Policies

    • Disable/restrict personal workspaces at the tenant level force all content into governed shared workspaces
    • Block export with data via tenant settings if that's the compliance risk
    • Block users from reassigning personal workspaces to prevent capacity/data residency issues
    • Use sensitivity labels + DLP to prevent sensitive data from being moved to ungoverned spaces

     

    For Detailed Information:

     

    Best Regards,
    Nasif Azam