Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Does anyone know how to authenticate to Lakehouse's SQL Analytics Endpoint, I have an On-behalf-Of flow, where the user signs in desktop app -> web api -> fabric endpoint. On the desktop application part I am issuing user principal authentication token, then authenticating to web api, then web api needs to authenticate to sql endpoint with that same user permissions. Security is set up on Sql Analytics endpoint part.
Web API is written in Python. Possible places I could've misunderstood are: are there any specific scopes I need to request to be able to query Fabric's sql endpoint?
client_app = ConfidentialClientApplication(client_id="x?",authority="y",client_credential="z")
token = client_app.acquire_token_on_behalf_of(token_issued_by_desktop_app,[scopes?])
return token["access_token"]
self.connection = pyodbc.connect(self.connection_string, attrs_before={1256: self.parm_access_token()})
Currently what I am seing is - Failed to connect to db1: ('28000', '[28000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Could not login because the authentication failed. (18456) (SQLDriverConnect); [28000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Could not login because the authentication failed. (18456)')
Solved! Go to Solution.
Hi @koltonist
Thank you for reaching out microsoft community forum.
To address the query about authenticating to Lakehouse's SQL Analytics Endpoint using an On-behalf-Of flow in a Python Web API, here are some key points and steps to consider:
The error Could not login because the authentication failed. (18456) indicates an authentication issue. Ensure that:
I have attaached MS docements for reference:
Microsoft Fabric SQL Analytics Endpoint Documentation
Microsoft Entra Authentication for SQL Analytics Endpoint
If this solution helps, please consider giving us Kudos and accepting it as the solution so that it may assist other members in the community.
Thank you.
Hi @koltonist
Thank you for reaching out microsoft community forum.
To address the query about authenticating to Lakehouse's SQL Analytics Endpoint using an On-behalf-Of flow in a Python Web API, here are some key points and steps to consider:
The error Could not login because the authentication failed. (18456) indicates an authentication issue. Ensure that:
I have attaached MS docements for reference:
Microsoft Fabric SQL Analytics Endpoint Documentation
Microsoft Entra Authentication for SQL Analytics Endpoint
If this solution helps, please consider giving us Kudos and accepting it as the solution so that it may assist other members in the community.
Thank you.
Check out the November 2025 Fabric update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!