Skip to content

Commit 2738fdc

Browse files
authored
Merge pull request #185347 from dimitri-furman/dimitri-furman-1
Clarified connectivity requirements
2 parents 62a79f0 + 42ea6bd commit 2738fdc

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

articles/azure-monitor/insights/sql-insights-enable.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Enable SQL insights in Azure Monitor
44
ms.topic: conceptual
55
author: bwren
66
ms.author: bwren
7-
ms.date: 1/6/2022
7+
ms.date: 1/18/2022
88
---
99

1010
# Enable SQL insights (preview)
@@ -196,6 +196,8 @@ The connection string specifies the login name that SQL insights should use when
196196
The connections string will vary for each type of SQL resource:
197197

198198
#### Azure SQL Database
199+
TCP connections from the monitoring machine to the IP address and port used by the database must be allowed by any firewalls or [network security groups](../../virtual-network/network-security-groups-overview.md) (NSGs) that may exist on the network path. For details on IP addresses and ports, see [Azure SQL Database connectivity architecture](../../azure-sql/database/connectivity-architecture.md).
200+
199201
Enter the connection string in the form:
200202

201203
```
@@ -208,36 +210,53 @@ Get the details from the **Connection strings** menu item for the database.
208210

209211
:::image type="content" source="media/sql-insights-enable/connection-string-sql-database.png" alt-text="SQL database connection string" lightbox="media/sql-insights-enable/connection-string-sql-database.png":::
210212

211-
To monitor a readable secondary, include the key-value `ApplicationIntent=ReadOnly` in the connection string. SQL Insights supports monitoring a single secondary. The collected data will be tagged to reflect primary or secondary.
213+
To monitor a readable secondary, append `;ApplicationIntent=ReadOnly` to the connection string. SQL Insights supports monitoring a single secondary. The collected data will be tagged to reflect primary or secondary.
212214

213215
#### Azure SQL Managed Instance
216+
TCP connections from the monitoring machine to the IP address and port used by the managed instance must be allowed by any firewalls or [network security groups](../../virtual-network/network-security-groups-overview.md) (NSGs) that may exist on the network path. For details on IP addresses and ports, see [Azure SQL Managed Instance connection types](../../azure-sql/managed-instance/connection-types-overview.md).
217+
214218
Enter the connection string in the form:
215219

216220
```
217221
"sqlManagedInstanceConnections": [
218222
"Server= mysqlserver.database.windows.net;Port=1433;User Id=$username;Password=$password;"
219223
]
220224
```
221-
Get the details from the **Connection strings** menu item for the managed instance.
222-
225+
Get the details from the **Connection strings** menu item for the managed instance. If using managed instance [public endpoint](../../azure-sql/managed-instance/public-endpoint-configure.md), replace port 1433 with 3342.
223226

224227
:::image type="content" source="media/sql-insights-enable/connection-string-sql-managed-instance.png" alt-text="SQL Managed Instance connection string" lightbox="media/sql-insights-enable/connection-string-sql-managed-instance.png":::
225228

226-
To monitor a readable secondary, include the key-value `ApplicationIntent=ReadOnly` in the connection string. SQL Insights supports monitoring of a single secondary. Collected data will be tagged to reflect Primary or Secondary.
229+
To monitor a readable secondary, append `;ApplicationIntent=ReadOnly` to the connection string. SQL Insights supports monitoring of a single secondary. Collected data will be tagged to reflect Primary or Secondary.
227230

228231
#### SQL Server
232+
The TCP/IP protocol must be enabled for the SQL Server instance you want to monitor. TCP connections from the monitoring machine to the IP address and port used by the SQL Server instance must be allowed by any firewalls or [network security groups](../../virtual-network/network-security-groups-overview.md) (NSGs) that may exist on the network path.
233+
234+
If you want to monitor SQL Server configured for high availability (using either availability groups or failover cluster instances), we recommend monitoring each SQL Server instance in the cluster individually rather than connecting via an availability group listener or a failover cluster name. This ensures that monitoring data is collected regardless of the current instance role (primary or secondary).
235+
229236
Enter the connection string in the form:
230237

231238
```
232239
"sqlVmConnections": [
233-
"Server=MyServerIPAddress;Port=1433;User Id=$username;Password=$password;"
240+
"Server=SQLServerInstanceIPAddress;Port=1433;User Id=$username;Password=$password;"
234241
]
235242
```
236243

237-
If your monitoring virtual machine is in the same VNET, use the private IP address of the Server. Otherwise, use the public IP address. If you're using Azure SQL virtual machine, you can see which port to use here on the **Security** page for the resource.
244+
Use the IP address that the SQL Server instance listens on.
245+
246+
If your SQL Server instance is configured to listen on a non-default port, replace 1433 with that port number in the connection string. If you're using Azure SQL virtual machine, you can see which port to use on the **Security** page for the resource.
238247

239248
:::image type="content" source="media/sql-insights-enable/sql-vm-security.png" alt-text="SQL virtual machine security" lightbox="media/sql-insights-enable/sql-vm-security.png":::
240249

250+
For any SQL Server instance, you can determine all IP addresses and ports it is listening on by connecting to the instance and executing the following T-SQL query, as long as there is at least one TCP connection to the instance:
251+
252+
```sql
253+
SELECT DISTINCT local_net_address, local_tcp_port
254+
FROM sys.dm_exec_connections
255+
WHERE net_transport = 'TCP'
256+
AND
257+
protocol_type = 'TSQL';
258+
```
259+
241260
## Monitoring profile created
242261

243262
Select **Add monitoring virtual machine** to configure the virtual machine to collect data from your SQL resources. Do not return to the **Overview** tab. In a few minutes, the Status column should change to read "Collecting", you should see data for the SQL resources you have chosen to monitor.

0 commit comments

Comments
 (0)