Introduction
Easily connect your Microsoft Fabric Lakehouse, Warehouse, or SQL Database to VS Code. This gives you the ability to run queries in read-only on Lakehouse’s, or full CRUD operations in Warehouses and SQL Databases from within VS Code. It is as easy as installing a VS Code extension to get started.
Fabric Lakehouse
I created a Lakehouse in Fabric several posts ago that I am going to use to set up in VS Code. Each Lakehouse in Fabric has a SQL Endpoint which is what we use to run SQL queries in the Lakehouse. It also allows us to connect with the MS SQL extension in VS Code.

VS Code
For those not aware, VS Code is a lightweight code editor that can run across all operating systems. Microsoft recently announced that Azure Data Studio was being discontinued, and its functionality is moving to VS Code. You can download VS Code from the Microsoft Store to get started, then go to extensions and look for SQL Server (mssql) to install it.

After installing the extension, go to the SQL Server connections window and here is where you will add the connection to Fabric.
Connect Fabric to VS Code
Go back to your Lakehouse in Fabric, from the top menu click on “Open In” and then on “Visual Studio Code”.

This opens a pop-up window that provides the Lakehouse SQL endpoint (server name) and database name to be used in setting the connection in VS Code.

Go to VS Code and SQL Server Connections and select the plus button to add a new connection.

A Connection Dialog tab is opened, here you need to provide your connection details.
- Profile Name: provide a name for this connection, it can be anything you would like.
- Connection Group: Only required if you have many connections and you want to put them in a group; you will need to create the group first.
- Input Type: select Parameters if it is not already selected.
- Server Name: copy this from the pop-up from Fabric
- Trust Server Certificate: Yes
- Authentication Type: Microsoft Entra ID
- Azure Account: Your Azure account username
- Tenant ID: The name of your Microsoft 365 tenant
- Database Name: copy this from the pop-up from Fabric
- Encrypt: Optional or Mandatory
Then click “Connect”.

Now that the connection is established, I am ready to run a query as shown below. I can also see all the database schemas and their tables just like I would when connecting to any SQL Server.

Closing
Connecting Visual Studio Code to Fabric opens a world of possibilities for data analysts, scientists, engineers, or developers. It streamlines workflows, enhances productivity, and provides seamless integration that makes querying and coding more efficient and enjoyable. So, take the plunge and explore the powerful synergy between Visual Studio Code and Fabric. Happy querying!