How to connect to CFI Databases Using Visual Studio
This article outlines how to install Visual Studio Code, add the Microsoft SQL extension, and connect to CFI course databases following the retirement of Azure Data Studio.
Prefer to learn by watching? Click here for a video walkthrough of the steps below.
Overview
With the upcoming retirement of Azure Data Studio, CFI learners will need an alternative tool to connect to course databases and continue completing SQL exercises.
The recommended alternative is Visual Studio Code (VS Code) with the Microsoft SQL Server (mssql) extension.
This guide walks you through:
- Installing Visual Studio Code
- Installing the SQL Server extension
- Connecting to your CFI course database
- Running your first SQL query
Step 1: Install Visual Studio Code
-
Go to the Visual Studio Code website:
Download the correct version for your operating system:
- Windows
- Mac
- Linux
- Install the application and open Visual Studio Code.
Optional:
You may also try the browser-based version at:
https://vscode.dev
This version runs directly in your browser, though most learners will use the desktop version.
Step 2: Install the SQL Server Extension
Before connecting to a database, you must install the Microsoft SQL extension.
- Open Visual Studio Code
- Click the Extensions icon on the left sidebar
- Search for:
mssql
- Locate SQL Server (mssql) – Microsoft
- Click Install
Once installed, additional SQL connection tools will appear in VS Code.
Step 3: Locate Your Database Credentials
From your CFI course page, locate the database connection credentials provided in the course materials.
You will need:
- Server name
- Username
- Password
- Database name
Keep this page open so you can copy the values.
Step 4: Add a Database Connection
- In VS Code, click the SQL Server connection icon
- Click the + (Add Connection) button
Fill in the connection fields:
| Field | What to Enter |
|---|---|
| Server Name | Copy from your course credentials |
| Authentication | SQL Login |
| Username | Provided in the course |
| Password | Provided in the course |
| Database Name | Provided in the course |
Important
You must enter the database name.
If you leave it blank, you may receive this error:
"User cannot connect to the master database."
- Enable Trust Server Certificate if prompted.
- Click Connect
If successful, your connection will appear in the SQL Server explorer panel.
Step 5: Rename the Connection (Recommended)
The default server name may appear very long and confusing if you connect to multiple databases.
To rename it:
- Right-click the connection
- Select Edit Connection
- Change the name to something meaningful, such as:
SQL Case Study
- Reconnect.
This makes it easier to identify later.
Step 6: Run Your First SQL Query
- Click New File
- Save or keep it as a SQL query file
- Write your query
Example:
SELECT * FROM table_name;
- Click the Run Query button (green play icon)
Keyboard shortcuts:
| System | Shortcut |
|---|---|
| Windows | Ctrl + Shift + E |
| Mac | Cmd + Shift + E |
Results will appear in the results panel below.
Success 🎉
If the query runs successfully and returns results, your database connection is working correctly.
You are now ready to complete your SQL course exercises in Visual Studio Code.
Additional Notes
- This setup replaces Azure Data Studio for CFI SQL courses.
- Once connected, you can reconnect quickly from the Saved Connections list.
- Future SQL course refreshes (including SQL Case Studies and SQL Fundamentals) will continue using this setup.
If you experience connection issues, double-check:
- Server name
- Username
- Password
- Database name
- SQL extension installation