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!Special holiday offer! You and a friend can attend FabCon with a BOGO code. Supplies are limited. Register now.
Hi All,
We are trying to connect to Fabric lakehouse using SQL Endpoint with Oauth and MSAL. We are sending the Fedauth for connection but in the respose we are receiving the ENVCHANGE and our connection is getting Rerouted after that to a new Endpoint.
1. Is it a expected behaviour?
2. If not then do we need to send some extra flag/info to make the Fabric server acknowledge the connection request.
We are able to connect to SQL database hosted in the same Fabric facility using same code setup. In this case we are receiving the FEDAUTH_INFO token and connecting to the Database successfully.
Can someone guide is on this?
Thanks
Solved! Go to Solution.
Hi @v-prasare , We found the solution for the issue. For lakehouse, the connection gets rerouted to some different URL. Initially we were tokenizing it and trying to connect to it, but the trick is you need to perform socket , prelogin on the original end point and "send the redirected URL to the login stage" while using the TDS protocol. PFB sample :
original Sql end point : nkttul5irfuejgeufneefoktjm-obtyxdfizvlura7ao2yincxurq.datawarehouse.fabric.microsoft.com
Redircted URL : pbipneu9-northeurope.pbidedicated.windows.net\ABCDUL5IRFUEJGEUFNEEFOKTJM-CCSJOZJPH6FE5GFNZMCN4ILWLA-dw:1433
Existing code logic trying to connect : pbipneu9-northeurope.pbidedicated.windows.net
Hi @Pratik_0527,
As we haven’t heard back from you, we wanted to kindly follow up to check if there is any progress on above mentioned issue. if you got any updates i requet you to please post here and accept as solution. This will help other community members with similar issues find answers easily.
Thanks,
Prashanth Are
MS Fabric community support
Hi @v-prasare , We found the solution for the issue. For lakehouse, the connection gets rerouted to some different URL. Initially we were tokenizing it and trying to connect to it, but the trick is you need to perform socket , prelogin on the original end point and "send the redirected URL to the login stage" while using the TDS protocol. PFB sample :
original Sql end point : nkttul5irfuejgeufneefoktjm-obtyxdfizvlura7ao2yincxurq.datawarehouse.fabric.microsoft.com
Redircted URL : pbipneu9-northeurope.pbidedicated.windows.net\ABCDUL5IRFUEJGEUFNEEFOKTJM-CCSJOZJPH6FE5GFNZMCN4ILWLA-dw:1433
Existing code logic trying to connect : pbipneu9-northeurope.pbidedicated.windows.net
Hi @Pratik_0527,
Thanks for providing your support ticket resolution here for visibility. please Accept as Solution by so, this will help other community members with similar issues can find answers easily.
Thanks,
Prashanth
MS Fabric community support
Hi @Pratik_0527,
As we haven’t heard back from you, we wanted to kindly follow up to check if there is any progress on above mentioned issue. if you got any updates i requet you to please post here and accept as solution. This will help other community members with similar issues find answers easily.
Thanks,
Prashanth Are
MS Fabric community support
Hi,
we are looking into it, will post answer once we are done here.
Thanks,
Prashanth Are
MS Fabric community support
Hi @v-prasare ,
Thank for reverting, We are stuck at a point and some quick guidance is really appreciated
Hi @Pratik_0527,
In the context of Microsoft Fabric, especially when using OAuth and MSAL for authentication, the system might redirect connection to a different endpoint to ensure optimal performance and security. This is particularly true when connecting to the SQL analytics endpoint of a Lakehouse, which is designed to handle SQL queries over Delta tables. The system may reroute connections to balance loads or to direct them to the appropriate compute resources.
refer to below docs for more info:
https://learn.microsoft.com/en-us/fabric/data-engineering/lakehouse-sql-analytics-endpoint
https://learn.microsoft.com/en-us/fabric/data-warehouse/connectivity
Thanks,
Prashanth Are
MS Fabric community support
Thanks for the reply Prashanth,
We raised this issue with the Fabric team and currently checking with them on how to handle this rerouting issue and establish the connection.
Thanks for the confirmation here @Pratik_0527 . please do post any updates here for visibilty on this issue.
Hi @v-prasare Sure once we get any information or breakthrough Will update on the thread