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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Vinodh247
Contributor III

Connect Fabric database from R studio

How to connect Fabric lakehouse db from R studio?

 

We have this requirement to access lakehouse db from within R studio. I searched and didnt find anything related to this, is there any workaround for this currently?

Please 'Kudos' and 'Accept as Solution' if this answered your query.

Regards,
Vinodh
Microsoft MVP [Fabric]
LI: https://www.linkedin.com/in/vinodh-kumar-173582132
Blog: vinsdata.in
3 REPLIES 3
Anonymous
Not applicable

Hi, @Vinodh247 

The following post tries to use RStudio to connect to Endpoint, you can try to test the connection using her method, whether this can give you inspiration.
Microsoft Fabric to RStudio Desktop - RStudio IDE - Posit Community

Also, the current version of Notebook supports the use of Visual Studio, so you can try using it too.


vyaningymsft_0-1725438724147.png

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

FlavioLeccese
New Contributor II

As an R user i would suggest you to use DBI and dbplyr.

 

- You can retrieve sql endpoint of that lakehouse
- Create a Service Principal in Azure and use it as a "super user" (https://learn.microsoft.com/it-it/entra/identity-platform/app-objects-and-service-principals?tabs=br...)

 

# r code:

driver <- "ODBC Driver 18 for SQL Server"
server <- "put here the sql end point of lakehouse"
database <- "lakehouse, ie database name"
authentication <- "ActiveDirectoryServicePrincipal"
encrypt <- "True"
userid <- "id of the Service Principal"
password <- "Password of the Service Principal"
port <- 1433

connection_string <- glue("Driver={driver}; Server={server}; UID={userid}; PWD={password}; Port={port}; Database={database}; Encoding=UTF-8; Authentication={authentication}")

con <- DBI::dbConnect(odbc::odbc(), .connection_string = connection_string)

 

This is a clean way and you can read tables also from outside MS Fabric, however, as far as I discovered, you won't be able to write but only to read

spencer_sa
Contributor III

Similar to the above two posts, we've used the ODBC driver.  For the proof of concept I used the AZ command line interface (AZCLI) tool to get a token as a user (so authenticating via web client) and then using that token with DBI.
(Incidentally, this is also how I've got the initial Fabric -> Alteryx connection working until I get the ADFS connection behaving)

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Free Fabric Certifications

Free Fabric Certifications

Get Fabric certified for free! Don't miss your chance.

January Fabric Update Carousel

Fabric Monthly Update - January 2026

Check out the January 2026 Fabric update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (732)