Skip to main content

Microsoft SQL Server

Connect a Microsoft SQL Server instance so NudgeBee can analyse its health and query it from workflows.

info

SQL Server is always reached through the Proxy Agent — there is no in-cluster secret mode. Forager must be able to open a TCP connection to the instance.


Prerequisites

  • A Proxy Agent that can reach the instance.
  • A SQL Server login NudgeBee can authenticate as, with read access to the database and to the dynamic management views.
-- In master: create the login and grant the server-level permission to it.
USE [master];
CREATE LOGIN nudgebee WITH PASSWORD = '<YOUR_PASSWORD>';
GRANT VIEW SERVER STATE TO nudgebee;

-- In each database you want NudgeBee to query:
USE [<your_database>];
CREATE USER nudgebee FOR LOGIN nudgebee;
ALTER ROLE db_datareader ADD MEMBER nudgebee;

VIEW SERVER STATE is a server-level permission, so it must be granted in master to the login, not in a user database to the database user. Running the GRANT after a USE [<your_database>] fails.

VIEW SERVER STATE is what makes the sys.dm_exec_* views readable — sys.dm_exec_requests, sys.dm_exec_sessions, sys.dm_exec_query_stats and sys.dm_exec_sql_text are all covered by it, and it is the only server-level permission NudgeBee needs. Without it, session and query analysis returns nothing.

db_datareader covers the application tables and the INFORMATION_SCHEMA lookups NudgeBee runs before querying an unfamiliar table. NudgeBee can target any database by name, so add the user to every database you want analysed; sys.databases is readable without an extra grant.


Step 1: Open the Configuration Form

Navigate to Admin > Integrations > Databases and select SQL Server, then click Add Mssql Account.

The SQL Server tile in the Databases tab of the integrations catalog

Step 2: Fill In the Connection

  • MSSQL host — Hostname or IP, e.g. db.example.com or 10.0.1.5. For a named instance, use the host and set the port explicitly rather than the host\instance form.
  • MSSQL port — Defaults to 1433.
  • Database name to connect to — The database NudgeBee opens.
  • TLS Enabled — Turn on for connections crossing a network boundary. Azure SQL requires it.
  • Credential Source, Database username *, Database password *, Read Only, Maximum open connections in the pool — see common fields.

The SQL Server configuration form, which offers Proxy Agent connection only

Step 3: Test and Save

Click Test Connection, then Save.


What Gets Connected

CapabilityWhat NudgeBee reads
Health checksys.dm_exec_sessions, sys.dm_exec_requests, blocking and wait statistics
Slow queriessys.dm_exec_query_stats joined to statement text
Workflow queriesAny SQL you supply via dbms.query with dbms_type: mssql

Verify the Integration

  1. Click Test Connection on the form — it should succeed before you save.
  2. Ask NuBi to check the health of the database by the name you gave it.
  3. In a workflow, run a dbms.query task with SELECT 1.

Troubleshooting

See the shared troubleshooting table first. SQL Server-specific cases:

SymptomLikely CauseFix
Login succeeds, management views emptyMissing VIEW SERVER STATEGRANT VIEW SERVER STATE TO nudgebee;
Cannot reach a named instanceSQL Browser resolution is not usedSet the instance's static TCP port in MSSQL port instead of relying on the instance name.
Login failed for user on Azure SQLUsername needs the server suffix, or TLS is offUse user@servername where required, and enable TLS Enabled.
Certificate validation errorsSelf-signed server certificateInstall a trusted certificate on the instance, or terminate TLS where Forager can validate it.