Forum Discussion

RishikeshPashte's avatar
RishikeshPashte
Icon for Microsoft Employee rankMicrosoft Employee
1 year ago
Solved

Fetching data from Fabric EventHouse's KQL DB using C#

I have a EventStream setup that fetches the data from an Azure EventHub and using the SQL SP filters out only the required columns and eventually dumps it into a Fabric EventHouse's KQL DB I...
  • v-lgarikapat's avatar
    v-lgarikapat
    1 year ago

    Hi Anonymous ,

    You're correctly:

    • Using a User Assigned Managed Identity (UAMI).
    • Acquiring a token with the proper Kusto (ADX) scope
    • Providing the UAMI with:
      • Contributor access on the Fabric workspace.
      • All available permissions on the Eventhouse / KQL DB.

    Yet you still get:

    <Client ID> is not authorized to read database

    That’s because Fabric’s implementation of KQL (Eventhouse) is not the same as regular Azure Data Explorer (ADX). It is currently missing support for certain Kusto management commands, role-based access control via Kusto commands, and cluster-level permission management.

     

     

    How to fix / move forward

    Temporary Workaround (Production Suggestion)

    For now, consider using a service principal (client ID + secret or cert) instead of a managed identity. Here's how:

    1. Register an Azure AD App in your tenant (if not already done).
    2. Assign the app the "Contributor" role at the Fabric workspace level.
    3. Use client credentials flow to authenticate and obtain a token for Kusto.
    4. Use the token with REST API or SDK to query the Eventhouse.

    If that also results in the same “not authorized” error — then the only viable workaround is:

    Access via a user identity with delegated permissions (not ideal for automation).

     Alternative: Hybrid Access via Power BI/Fabric Pipelines

    You can consider building a Fabric Data Factory pipeline that runs queries against KQL DB (Eventhouse), where access is mediated by Fabric workspace-level permissions (which do work), rather than calling the REST API directly.

    That’s not always production-grade for app-level access, but it's a viable workaround while Microsoft continues expanding Fabric capabilities

     

    Add an Eventhouse destination to an eventstream - Microsoft Fabric | Microsoft Learn

    Configure managed identities for your Azure Data Explorer cluster - Azure Data Explorer | Microsoft Learn

     

    If this post helped resolve your issue, please consider giving it Kudos and marking it as the Accepted Solution. This not only acknowledges the support provided but also helps other community members find relevant solutions more easily.

    We appreciate your engagement and thank you for being an active part of the community.

    Best regards,
    LakshmiNarayana.