Forum Discussion

softbrendan's avatar
softbrendan
New Member
1 year ago
Solved

CustomGPT Fabric integration with RLS

Hey  has anyone successfully connected a Custom GPT to Microsoft Fabric data using the REST API or any other supported query endpoint?

 

We're using OAuth 2.0 with delegated scopes like Dataset.ReadWrite.All and SemanticModel.Read.All, and our Custom GPT is successfully accessing Fabric data through GraphQL — but GraphQL does not enforce Row-Level Security (RLS).

Our goal is to enforce RLS in the data being accessed by the GPT.

We've tested the executeQueries REST API against Fabric datasets, but hit EntityNotFound errors, likely because the Fabric model is bound to a Direct Lake connection using SSO, and the GPT isn't running with a user identity that SSO can impersonate.

 

  1. Has anyone managed to access Fabric data with enforced RLS from a Custom GPT?

  2. Are there specific endpoint types (DAX, SQL Analytics, GraphQL, etc.) that do support RLS with OAuth app flows or service principals?

  3. Is there a recommended way to configure Fabric so a Custom GPT can query data with RLS enforced, even if it's not via semantic models?

We’re open to any Fabric-supported pattern that allows GPTs to retrieve RLS-secured data.

5 Replies

  • Hi softbrendan 

    To enforce Row-Level Security (RLS) when connecting a Custom GPT to Microsoft Fabric data, you must authenticate with a user-delegated OAuth token—not as a service principal or app-only app. RLS is only enforced when queries are made with the actual user’s identity (using OAuth 2.0 Authorization Code flow), typically through DAX or SQL endpoints such as the XMLA endpoint or SQL Analytics endpoint.

     

    GraphQL endpoints do not enforce RLS, and app-only or service principal tokens will bypass RLS rules by design. The recommended approach is to have your Custom GPT authenticate as the user and query Fabric using their token; this allows Fabric to apply RLS as intended. For more details, see Enforce RLS for Direct Lake and XMLA endpoint and RLS in Microsoft’s documentation.

  • v-nmadadi-msft's avatar
    v-nmadadi-msft
    Community Support

    Hi softbrendan 
    Thanks for reaching out to the Microsoft fabric community forum.


    As your objective is to use RLS with your Fabric data, you can try to use XMLA endpoint with third party tools with which you will be able to use RLS roles
    Semantic model connectivity and management with the XMLA endpoint in Power BI - Power BI | Microsoft Learn
    The following limitations apply when working with roles through the XMLA endpoint:

    • The only permission for a role that can be set for semantic models is Read permission. Other permissions are granted using the Power BI security model.
    • Service Principals do not work with RLS and OLS, and cannot be added as model role members.
    • Build permission for a semantic model is required for read access through the XMLA endpoint, regardless of the existence of semantic model roles.

     

    I hope this information helps. Please do let us know if you have any further queries.
    Thank you

  • v-nmadadi-msft's avatar
    v-nmadadi-msft
    Community Support

    Hi softbrendan 

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.


    Thank you.

    • softbrendan's avatar
      softbrendan
      New Member

      yes we got it working for semantic endpoints.

      • v-nmadadi-msft's avatar
        v-nmadadi-msft
        Community Support

        Hi softbrendan ,

        We really appreciate your efforts and for letting us know the update on the issue.
        It would be greatly appreciated if you could share your insights on how exactly you got it working with the community. This would be helpful for other members who may encounter similar issues.

        Please continue using fabric community forum for your further assistance.
        Thank you