You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Learn how to connect to Azure SQL Database or SQL Managed Instance on Azure by using Visual Studio Code. Then, run Transact-SQL (T-SQL) statements to query and edit data.
4
+
description: Learn how to connect to Azure SQL Database or Azure SQL Managed Instance by using Visual Studio Code. Then, run Transact-SQL (T-SQL) statements to query and edit data.
[Visual Studio Code](https://code.visualstudio.com/docs) is a graphical code editor for Linux, macOS, and Windows. It supports extensions, including the [mssql extension](https://aka.ms/mssql-marketplace) for querying a SQL Server instance, Azure SQL Database, an Azure SQL Managed Instance, and a database in Azure Synapse Analytics. In this quickstart, you'll use Visual Studio Code to connect to Azure SQL Database or Azure SQL Managed Instance and then run Transact-SQL statements to query, insert, update, and delete data.
21
+
[Visual Studio Code](https://code.visualstudio.com/docs) is a graphical code editor for Linux, macOS, and Windows. It supports extensions, including the [mssql extension](https://aka.ms/mssql-marketplace) for querying SQL Server, Azure SQL Database, Azure SQL Managed Instance, and a database in Azure Synapse Analytics. In this quickstart, you use Visual Studio Code to connect to Azure SQL Database or Azure SQL Managed Instance and then run Transact-SQL statements to query, insert, update, and delete data.
Make sure you have installed the latest [Visual Studio Code](https://code.visualstudio.com/Download) and loaded the [mssql extension](https://aka.ms/mssql-marketplace). For guidance on installing the mssql extension, see [Install Visual Studio Code](/sql/linux/sql-server-linux-develop-use-vscode#install-and-start-visual-studio-code) and [mssql for Visual Studio Code
Make sure you have installed the latest [Visual Studio Code](https://code.visualstudio.com/Download). For installation guidance, see [Install Visual Studio Code](/sql/linux/sql-server-linux-develop-use-vscode#install-and-start-visual-studio-code).
45
43
46
44
## Configure Visual Studio Code
47
45
46
+
### Windows
47
+
48
+
Load the [mssql extension](https://aka.ms/mssql-marketplace) by following these steps:
49
+
50
+
1. Open Visual Studio Code.
51
+
1. Open the Extensions pane (or **Ctrl + Shift + X**).
52
+
1. Search for `sql` and then install the **SQL Server (mssql)** extension.
53
+
54
+
For additional installation guidance, see [mssql for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-mssql.mssql).
55
+
48
56
### macOS
49
57
50
58
For macOS, you need to install OpenSSL, which is a prerequisite for .NET Core that mssql extension uses. Open your terminal and enter the following commands to install **brew** and **OpenSSL**.
Load the [mssql extension](https://aka.ms/mssql-marketplace) by following these steps:
64
72
65
-
### Windows
73
+
1. Open Visual Studio Code.
74
+
1. Open the Extensions pane (or **Ctrl + Shift + X**).
75
+
1. Search for `sql` and then install the **SQL Server (mssql)** extension.
66
76
67
-
No special configuration needed.
77
+
For additional installation guidance, see [mssql for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-mssql.mssql).
68
78
69
79
## Get server connection information
70
80
71
-
Get the connection information you need to connect to Azure SQL Database. You'll need the fully qualified server name or host name, database name, and login information for the upcoming procedures.
81
+
Get the connection information you need to connect to Azure SQL Database. You need the fully qualified server name or host name, database name, and login information for the upcoming procedures.
72
82
73
83
1. Sign in to the [Azure portal](https://portal.azure.com/).
74
84
@@ -82,7 +92,7 @@ In Visual Studio Code, set the language mode to **SQL** to enable mssql command
82
92
83
93
1. Open a new Visual Studio Code window.
84
94
85
-
1. Press **Ctrl**+**N**. A new plain text file opens.
95
+
1. Press **Ctrl + N**. A new plain text file opens.
86
96
87
97
1. Select **Plain Text** in the status bar's lower right-hand corner.
88
98
@@ -95,13 +105,13 @@ Use Visual Studio Code to establish a connection to your server.
95
105
> [!IMPORTANT]
96
106
> Before continuing, make sure that you have your server and sign-in information ready. Once you begin entering the connection profile information, if you change your focus from Visual Studio Code, you have to restart creating the profile.
97
107
98
-
1. In Visual Studio Code, press **Ctrl+Shift+P** (or **F1**) to open the Command Palette.
108
+
1. In Visual Studio Code, press **Ctrl + Shift + P** (or **F1**) to open the Command Palette.
99
109
100
-
1.Select **MS SQL:Connect**and choose **Enter**.
110
+
1.Type `connect`and then choose **MS SQL:Connect**.
101
111
102
-
1. Select **Create Connection Profile**.
112
+
1. Select **+ Create Connection Profile**.
103
113
104
-
1. Follow the prompts to specify the new profile's connection properties. After specifying each value, choose**Enter** to continue.
114
+
1. Follow the prompts to specify the new profile's connection properties. After specifying each value, press**Enter** to continue.
105
115
106
116
| Property | Suggested value | Description |
107
117
| --- | --- | --- |
@@ -129,9 +139,9 @@ Run the following [SELECT](/sql/t-sql/queries/select-transact-sql) Transact-SQL
129
139
ONpc.ProductCategoryId=p.ProductCategoryId;
130
140
```
131
141
132
-
1. Press **Ctrl**+**Shift**+**E** to run the query and display results from the `Product` and `ProductCategory` tables.
142
+
1. Press **Ctrl + Shift + E** to run the query and display results from the `Product` and `ProductCategory` tables.
133
143
134
-
:::image type="content" source="./media/connect-query-vscode/query.png" alt-text="Screenshot of query to retrieve data from 2 tables.":::
144
+
:::image type="content" source="./media/connect-query-vscode/query.png" alt-text="Screenshot of query to retrieve data from 2 tables." lightbox="./media/connect-query-vscode/query.png":::
135
145
136
146
## Insert data
137
147
@@ -160,7 +170,7 @@ Run the following [INSERT](/sql/t-sql/statements/insert-transact-sql) Transact-S
160
170
);
161
171
```
162
172
163
-
1. Press **Ctrl**+**Shift**+**E** to insert a new row in the `Product` table.
173
+
1. Press **Ctrl + Shift + E** to insert a new row in the `Product` table.
164
174
165
175
## Update data
166
176
@@ -174,7 +184,7 @@ Run the following [UPDATE](/sql/t-sql/queries/update-transact-sql) Transact-SQL
174
184
WHERE Name ='myNewProduct';
175
185
```
176
186
177
-
1. Press **Ctrl**+**Shift**+**E** to update the specified row in the `Product` table.
187
+
1. Press **Ctrl + Shift + E** to update the specified row in the `Product` table.
178
188
179
189
## Delete data
180
190
@@ -187,7 +197,7 @@ Run the following [DELETE](/sql/t-sql/statements/delete-transact-sql) Transact-S
187
197
WHERE Name ='myNewProduct';
188
198
```
189
199
190
-
1. Press **Ctrl**+**Shift**+**E** to delete the specified row in the `Product` table.
200
+
1. Press **Ctrl + Shift + E** to delete the specified row in the `Product` table.
Copy file name to clipboardExpand all lines: azure-sql/database/connectivity-architecture.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,8 +51,6 @@ Servers in SQL Database and dedicated SQL pools (formerly SQL DW) in Azure Synap
51
51
52
52
We highly recommend the `Redirect` connection policy over the `Proxy` connection policy for the lowest latency and highest throughput. However, you need to meet the extra requirements for allowing network traffic as outlined above. If the client is an Azure Virtual Machine, you can accomplish this using Network Security Groups (NSG) with [service tags](/azure/virtual-network/network-security-groups-overview#service-tags). If the client is connecting from a workstation on-premises, you may need to work with your network admin to allow network traffic through your corporate firewall.
53
53
54
-
> [!IMPORTANT]
55
-
> Connections to private endpoint only support **Proxy** as the [connection policy](connectivity-architecture.md#connection-policy).
0 commit comments