Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
RishikeshPashte
Microsoft Employee
Microsoft Employee

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

RishikeshPashte_0-1747365385609.png


Is there any way, that I can fetch the data from the above EventHouse KQL DB into my C# solution? Below is the screehot of the KQL DB present in the Fabric EventHub

RishikeshPashte_1-1747365540966.png



Also, I tried selecting the option 'Make OneLake Available' as ON and tried fetching the data using Fabric NoteBook as mentioned in the MS Learn article -Eventhouse OneLake Availability - Microsoft Fabric | Microsoft Learn , it throwed me the below error

RishikeshPashte_5-1747365934158.png

12 REPLIES 12
svelde
Advocate I
Advocate I

Hi @RishikeshPashte ,

Welcome to this Fabric community forum.

Using C# is for Eventhouse the same as for Azure Data Explorer.

See this blog post for working with C# against the database with KQL.

 

Regarding the Onelake availability question, please create a second question in this forum so those having the same questions can find it (because it's not part of this 'unrelated' thread). Please provide detailed information about the steps you have taken, what works and where the error pops up. did you see that note about the 'Azure Data Explorer database' thus Eventhouse?

 

 

 

Hi @svelde 

Appreciate the response, I work with Rishikesh and went through the blog post you shared.

 

The steps mentioned there seem to be related to the Azure Data Explorer, and not the native Fabric Eventhouse/KQL we are using. Just an example, the below query asked to be ran can only be run in ADX and not Eventhouse/KQL DB:
.add database sdktestdata viewers ('aadapp=[application-id];[tenant-guid]')

 

Please correct me if my understanding is wrong. Thanks.

Hello FawadAhmedMAQ

 

Fabric Eventhouse is Azure Data Explorer under the covers, so the Eventhouse also exposes a simular Query URI endpoint so technically, the same API calls can be made.

 

You are right about the user credentials, the way to give the SDK access to Eventhouse tables or databases is not on par with Azure Data Explorer. I cannot find a reference for providing access to the KQL database tables to (managed) identities.

 

Still, it could be possible to use the 'current user' if we can impersonate that account.

 

I remember I was able to have Managed Grafana connected to the Eventhouse the same way

 

I see v-lgarikapat  posted an alternative flow where an EntraID application registration is used.  

v-lgarikapat
Community Support
Community Support

Hi @RishikeshPashte ,
Thank you for your response,  Please don’t hesitate to reach out if anything is needed from my end.

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,

Lakshmi Narayana.

Hi @RishikeshPashte ,
If your question has been answered, kindly mark the appropriate response as the Accepted Solution. This small step goes a long way in helping others with similar issues.

We appreciate your collaboration and support!

Best regards,
LakshmiNarayana

Hi @RishikeshPashte ,

If your issue has been resolved, please mark the most helpful reply as the Accepted Solution to close the thread. This helps ensure the discussion remains useful for other community members.

Thank you for your attention, and we look forward to your confirmation.

Best regards,
LakshmiNarayana

RishikeshPashte
Microsoft Employee
Microsoft Employee

Hey @v-lgarikapat, thanks for the suggestions. Will look into them, thanks

v-lgarikapat
Community Support
Community Support

Hi @RishikeshPashte ,
Thanks for reaching out to the Microsoft fabric community forum.

Yes, you can fetch data from a Fabric EventHouse KQL database into a C# solution, but it requires using Kusto REST APIs (Data Explorer) or Azure SDKs designed for querying Kusto (KQL) databases. Here's how you can proceed:

 

 Option 1: Use Kusto (ADX) REST API in C#

You can send KQL queries to your EventHouse using HTTP requests in C#. Here's a basic

Step-by-step:

  1. Register an App in Azure AD:
    • Go to Azure Active Directory > App Registrations > Register your app.
    • Set permissions for Azure Data Explorer (Kusto).
  1. Get Authentication Token:
    Use Microsoft.Identity.Client to acquire a token for your app.
  2. Use HTTPClient in C# to query:
    Here's a C# sample to fetch data from KQL DB:

Option 2: Use Azure Data Explorer SDK for .NET

This is a more structured way using Microsoft.Azure.Kusto.Data package.

Regarding Fabric Notebooks & OneLake Availability Error

The error you're seeing when enabling OneLake Availability is likely due to insufficient permissions or schema misconfiguration in your EventHouse instance. Fabric is still evolving with its integration, and sometimes the Kusto-backed EventHouse isn't immediately accessible through notebooks unless it's explicitly materialized or exposed

1.OneLake Mounting Delay

  • After you enable “Make OneLake Available” in EventHouse, it can take a few minutes (sometimes longer) for OneLake to reflect the new mount.
  •  Fix: Wait 10–15 minutes and refresh the notebook or try again later.
  1. Dataset/Schema Not Synced or Empty

If you found this post helpful, please 'consider giving it Kudos' and marking it as the 'accepted solution' to assist other members in finding it more easily.

Thank you.

Best Regards,

LakshmiNarayana

Hi @v-lgarikapat 

I work with OP and tried following both of your options, please find issues below:

  1. Option 1: Use Kusto (ADX) REST API in C#
    1. Which permissions do we need to add to our App? The only ADX related permission I see is related to user_impersonation which we don't want to do
    2. We tried this approach by using our User Assigned managed identity and were able to successfully generate an access token using the Kusto Scope. However, when running the execute query it fails giving the error "<Client ID of managed identity> is not authorized to read database"
      Note: We have given the identity Contributor access at Workspace level, and also given it all available permissions at KQL EventHouse level.
  2. Option 2: Use Azure Data Explorer SDK for .NET
    1. Tried this method as well, used the SDK built in functions and tried to access the Kusto with our managed identity as credential
    2. Got the same error as above, that the identity did not have access to the Database. Check Note above higlighting accesses already provisioned.

Need help on how to move forward from this access issues. Does Fabric Kusto KQL even support managed identity based auth? If not what is the suggested alternative for Production level applications? Any help I try to get online points me to run Cluster level queries to add admin/users, but those are not available in Native Fabric KQL as much as I am aware.

 

Hi @FawadAhmedMAQ ,

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 ...

 

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.

Hi @FawadAhmedMAQ ,

As we haven't heard back from you, we are closing this thread. If you are still experiencing the same issue, we kindly request you to create a new thread we’ll be happy to assist you further.

Thank you for your patience and support.

If our response was helpful, please mark it as Accepted as Solution.
Feel free to reach out if you need any further assistance.

Best Regards,

Lakshmi Narayana

Hi @v-lgarikapat,

Any idea on this?

Helpful resources

Announcements
May FBC25 Carousel

Fabric Monthly Update - May 2025

Check out the May 2025 Fabric update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors