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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

New Member

C# to Lakehouse SQL Analytics Endpoint not connecting

I have a console app in C# .net framework. I am trying to connect MS Fabric Lakehouse SQL Analytics Endpoint using Service Principal, but it always gives me error 'Could not login because the authentication failed.', when i researched i found in community (authenticate to Fabric Data Warehouse with Service... - Microsoft Fabric Community) it says in SQL query window Create a user with your service principal name and add db_owner role. But when i tried to execute the query it says 'CREATE USER is not a supported statement type.' Its a deadlocak, i want to access Lakehouse tables from C# without user interaction login. Kindly Assist.


//Not working
string connectionString = @"Data,1433;
Initial Catalog=insights_LH_PRD;
Authentication=Active Directory Service Principal;
User ID=[ClientId];


SqlConnection conn = new SqlConnection(connectionString);

Community Support
Community Support

Hi @jigmoth ,

Thanks for using Fabric Community.
The answer provided for this thread - authenticate to Fabric Data Warehouse with Service... - Microsoft Fabric Community assuming user would like to connect Azure SQL using pyodbc in Fabric via Service Principal..


If you are tring to connecting MS Fabric Lakehouse SQL Analytics Endpoint using Service Principal

Note: After creating Service Prinipal in Azure Entra ID. 
You need to add service principal to Fabric workspaces like this:



Make sure to allow access to service principals by enabling below option in Admin Portal:


After providing the access you should be able to do the connection using Service Principal.

Docs to refer - 
c# - Generating token for Fabric Rest api using client secret - Stack Overflow
Connectivity to data warehousing - Microsoft Fabric | Microsoft Learn


Hope this is helpful. Please let me know incase of further queries.

Thank you for responding, for me i cannot see Tenant settings options and many other menus, i can only see Capacity Settings & Help Support. What am i missing here?



Hi @jigmoth ,

It looks like you do not have the necessary permissions.

I can find a similar thread -
Solved: Admin Portal Only Has Capacity Settings ONLY - No... - Microsoft Fabric Community

Thank you

Hello @jigmoth ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet .
In case if you have any resolution please do share that same with the community as it can be helpful to others .
Otherwise, will respond back with the more details and we will try to help .

Hello, Yes this worked for me thank you. Appreciate you help.

Hi @jigmoth ,

Glad to know that your issue got resolved. Please continue using Fabric Community on your further queries.

Helpful resources

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July Newsletter

Fabric Community Update - July 2024

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