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

  1. Go to the Visual Studio Code website:

    https://code.visualstudio.com

    Download the correct version for your operating system:

    • Windows
    • Mac
    • Linux
  2. 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.

  1. Open Visual Studio Code
  2. Click the Extensions icon on the left sidebar
  3. Search for:
mssql
  1. Locate SQL Server (mssql) – Microsoft
  2. 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

  1. In VS Code, click the SQL Server connection icon
  2. 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."

  1. Enable Trust Server Certificate if prompted.
  2. Click Connect

If successful, your connection will appear in the SQL Server explorer panel.


The default server name may appear very long and confusing if you connect to multiple databases.

To rename it:

  1. Right-click the connection
  2. Select Edit Connection
  3. Change the name to something meaningful, such as:
SQL Case Study
  1. Reconnect.

This makes it easier to identify later.


Step 6: Run Your First SQL Query

  1. Click New File
  2. Save or keep it as a SQL query file
  3. Write your query

Example:

SELECT * 
FROM table_name;
  1. 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
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.