Before You Start
Your instructor will give you a connection card with these values. Keep it nearby, but do not paste the card into a public document, GitHub repository, or help request.
provided-by-instructor.postgres.database.azure.com5432provided by instructoryour assigned loginyour assigned passwordRequire1 Install Visual Studio Code
- Go to the official VS Code download page.
- Download the Stable release for your operating system. Do not use the Insiders build for this course.
-
Install it:
- Windows: run the User Setup
.exeand accept the defaults. - macOS: open the
.dmgand drag Visual Studio Code into Applications. - Linux: use the
.debor.rpmpackage appropriate for your distribution.
- Windows: run the User Setup
- Open Visual Studio Code.
The full operating-system-specific instructions are in the official VS Code setup guide.
2 Install Microsoft's PostgreSQL Extension
- Open the Extensions view from the left Activity Bar, or press Ctrl+Shift+X on Windows/Linux or Cmd+Shift+X on macOS.
- Search for PostgreSQL.
- Select PostgreSQL published by Microsoft, then choose Install.
ms-ossdata.vscode-pgsql
After installation, a PostgreSQL elephant icon appears in the Activity Bar. Select it to open the PostgreSQL view.
3 Connect to the Course Server
- Open the PostgreSQL view. Under Connections, select Add New Connection (the + icon).
- Leave Connect via set to Parameters.
- Enter the values from your course connection card.
| VS Code field | What to enter |
|---|---|
| Server name | The full Azure host name from your instructor. Do not include https://. |
| Authentication Type | Password, unless your instructor explicitly says to use Entra Auth. |
| User name | Your assigned PostgreSQL login. |
| Password | Your assigned PostgreSQL password. |
| Database name | The assigned course database, not a name you invent. |
| Connection Name | MaDS SQL · Fall 2026 or another clear label. |
- Select Advanced. Confirm the port is
5432, then open the SSL section and set SSL mode to Require. - On your own computer, you may select Save Password. Do not save it on a shared or lab computer.
- Select Test Connection. When the test succeeds, select Save & Connect.
A successful connection appears in the Connections tree with a green status indicator.
4 Run a Verification Query
- Right-click your connected server and select New Query.
- Confirm that the database dropdown in the query editor shows the database your instructor assigned.
- Paste and run this query:
SELECT
current_database() AS database_name,
current_user AS signed_in_as,
version() AS server_version;
Run the current statement with Ctrl+Shift+E on Windows/Linux or Cmd+Shift+E on macOS. You should see one result row with your database, login, and PostgreSQL version.
Optional: see the course tables
SELECT table_schema, table_name
FROM information_schema.tables
WHERE table_schema NOT IN ('pg_catalog', 'information_schema')
ORDER BY table_schema, table_name;
If the instructor has already loaded course data, this lists the tables you can query. An empty result does not mean the connection failed; it may mean the tables have not been loaded yet.
- VS Code opens normally.
- The PostgreSQL elephant appears in the Activity Bar.
- Your course connection has a green status indicator.
- The verification query returns one row.
Troubleshooting
| What you see | Most likely cause | What to do |
|---|---|---|
| “Could not translate host name” or “Name or service not known” | The server name was mistyped. | Copy the full host name again. Do not add spaces or https://. |
| The connection times out | Your current IP address is not allowed by the Azure firewall, or the server is stopped. | Send your instructor your current public IP using the class-approved process. Do not post credentials. |
| “Password authentication failed” | The user name or password is wrong. | Retype both values. Watch for a copied trailing space. Ask the instructor to reset the password if needed. |
| An SSL or TLS error | The connection is not requiring encryption. | Edit the connection, open Advanced → SSL, and choose Require. |
| The query runs against the wrong database | The query editor is using another database context. | Choose the assigned database from the query editor's database dropdown. |
| No PostgreSQL elephant icon | The extension is missing, disabled, or not the Microsoft extension. | Open Extensions and verify ID ms-ossdata.vscode-pgsql. Reload VS Code if prompted. |