Forum Discussion

Pratik_0527's avatar
Pratik_0527
Icon for Helper I rankHelper I
1 year ago
Solved

Lakehouse Connection issue using SQL Endpoint

Hi All,

 

Im trying to connect to Fabric Lakehouse through a C++ using the SQL Endpoint. I have registered the APP in Azzure and generated a client ID. Using this to connect im getting below error. Can somebody guide what needs to be done here? Are we missing anything ?

Error Message : "Error details: error invalid_client error_description: AADSTS650057: Invalid resource. The client has requested access to a resource which is not listed in the requested permissions in the client's application registration. Resource value from request: https://pbipneu9-northeurope.pbidedicated.windows.net. Resource app ID: cb4dc29f-0bf4-402a-8b30-7511498ed654. List of valid resources from app registration: 00000003-0000-0000-c000-000000000000."

  • Hi Anonymous , 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

14 Replies

  • Hi Pratik_0527 

     

    have you done this?

     

    Navigate to your app registration in the Azure Portal.
    2. Under API permissions, click + Add a permission → Microsoft APIs → Power BI Service.
    3. Select delegated or application permissions (e.g., `Dataset.ReadWrite.All` or `Reports.Read.All`, depending on your use case).
    4. Click Add permissions and have an admin grant tenant-wide consent

    • Pratik_0527's avatar
      Pratik_0527
      Icon for Helper I rankHelper I

      Hi nilendraFabric we do have this permission setup present in Azzure. Also we are not using Power BI. its a C++ driver code.

  • Anonymous's avatar
    Anonymous
    Not applicable

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

    Check these troubleshooting steps:

    -> Please ensure that the caller has contributor or higher workspace role.

    -> The required delegated scope to call lakehouse are Lakehouse.ReadWrite.All or item.ReadWrite.All, ensure                 these are in place.

    ->  Since you're calling from a C++ app make sure you're using the correct token endpoint.
           For Ex if it is to get lakehouse it should be something like this
           GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/lakehouses/{lakehouseId}


    If this post helps, then please consider Accepting as solution to help the other members find it more quickly and consider giving a KUDOS. Feel free to reach out if you need further assistance.
    Thank you

    • Pratik_0527's avatar
      Pratik_0527
      Icon for Helper I rankHelper I

      Hi Anonymous We have verified the enpoint that we are using with the help of Native driver by microsoft and the SSMS tool. Both are able to connect to the Lakehouse. 
      Also we are not using CURL as the "GET" request suggested by you shows something like CURL API.
      Let us know if Lakehouse connectivity requires CURL API calls?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Pratik_0527 ,

        If you are trying to connect to SQL endpoint using a C++ app,
        you have to use REST API and the supported features for it are 

        Items - REST API (SQLEndpoint) | Microsoft Learn

        whereas for lakehouse these are the supported features


        Items - REST API (Lakehouse) | Microsoft Learn


        If this post helps, then please consider Accepting as solution to help the other members find it more quickly and consider giving a KUDOS. Feel free to reach out if you need further assistance.
        Thank you



  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Pratik_0527 ,

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Pratik_0527 

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the community members for the issue worked. If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Thanks and regards

    • Pratik_0527's avatar
      Pratik_0527
      Icon for Helper I rankHelper I

      Hi Anonymous the issue is still there. We are not able to connect yet. Also some of the solutions suggested were using highend APIs like REST which our current code is not dealing with. We are working with Microsoft fabric team and will update here as soon as we get any break through

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Pratik_0527 ,
        Thank you for providing an update to your issue. As suggested please explore modifications to your code to integrate REST API.
        Also kindly update the community members if there is any breakthrough with Fabric team so as to help other members who may face similar issue in the future.
        Thank you

    • Pratik_0527's avatar
      Pratik_0527
      Icon for Helper I rankHelper I

      Hi Anonymous , 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

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Pratik_0527 ,

        We really appreciate your efforts and for letting us know the update on the issue.
        Please accept your reply as the solution so as to help other community members who may come across this post in the future.

        Additionally continue using fabric community forum for your further assistance.
        Thank you