Connect a SQL Server database once, and your flows can read, add, change and delete rows, call stored procedures, run your own SQL, start when a row is added, changed or deleted, and let an AI node use only the tables and procedures you choose. It works with SQL Server 2017 or later, Azure SQL Database, Azure SQL Managed Instance and Amazon RDS for SQL Server.
HostWebhook can do whatever the database user can do.
Give it a user of its own, with only what your flow needs (see step 01).
Connect your database
In HostWebhook, click Settings in the left sidebar, then Credentials, and start a new credential. Choose SQL Server and give it a name.
- Marker 1: Host and Port: your server's address, like
myserver.database.windows.net, and its port (1433 if you leave it empty). - Marker 2: Database: Azure SQL Database needs it, because a connection is to one database. On other servers it is optional, and a node can pick another.
- Marker 3: TLS: Strict encrypts the connection before anything else and checks the certificate.
Under Sign in with, leave SQL login and fill in User and Password. To sign in with an app of your Microsoft Entra tenant instead, see step 02.
The connection is always encrypted and the certificate is always checked: there is no Off, and no mode that accepts any certificate. Pick how HostWebhook checks it:
| TLS | What it does |
|---|---|
| Strict | Encrypted before anything else, and the certificate is checked. Azure SQL, SQL Server 2022 or later on Windows, and SQL Server 2025 on Linux. SQL Server 2022 on Linux doesn't take it |
| Required | Encrypted, and the certificate is checked. The default. Like Azure SQL and RDS |
The CA certificate is what HostWebhook checks that certificate against:
| Where it lives | CA certificate |
|---|---|
| Azure SQL Database and Managed Instance | The usual public roots. Nothing to paste |
| Amazon RDS for SQL Server | Amazon RDS |
| Your own server, or a company CA | Paste a certificate, with the PEM your server uses |
- Marker 1: TLS stays on Required.
- Marker 2: Amazon RDS uses the AWS certificates HostWebhook already carries.
If your server only lets in some addresses, add the IP the form shows under Allowlist this IP on your SQL Server. Azure SQL calls it the server firewall, RDS a security group, and a Managed Instance a network security group. A Managed Instance answers on its public endpoint, which you turn on first, on port 3342: use that port, and open it in the network security group.
Click Save SQL Server connection. Saving doesn't connect, so open the credential and click Test connection. It answers with one line, like SQL Server 2022 (16.0.4135) · Azure SQL Database · TLS 1.3 · Strict · hostwebhook. It also warns you if the user is a sysadmin or the db_owner of the database, which is far more than a flow needs, and suggests Strict when the server allows it and the credential has no tunnel: through a tunnel, it doesn't suggest it.
Give HostWebhook a user of its own
On Azure SQL Database, create the user inside the database you connect to:
CREATE USER hostwebhook WITH PASSWORD = 'a long password';
On SQL Server, a Managed Instance and RDS, create a login, and then the user in the database:
CREATE LOGIN hostwebhook WITH PASSWORD = 'a long password', CHECK_POLICY = ON; CREATE USER hostwebhook FOR LOGIN hostwebhook;
Then give it what your flows use, and nothing else:
GRANT SELECT, INSERT, UPDATE ON dbo.orders TO hostwebhook; GRANT EXECUTE ON dbo.usp_create_order TO hostwebhook;
Add DELETE only if a flow deletes, and EXECUTE only on the procedures a flow calls. A trigger only needs SELECT on the table it watches, and VIEW CHANGE TRACKING if it uses Change Tracking (step 07). Never give it sysadmin, db_owner or CONTROL.
A SQL login needs a server in mixed mode. If yours only accepts Windows authentication, change that and restart the service.
Paste a connection string instead
Click Paste a connection string instead and paste what the Azure portal gives you, like Server=tcp:myserver.database.windows.net,1433;Initial Catalog=shop;User ID=…;Password=…;Encrypt=True;. HostWebhook reads the server and port, the database, the user, the password, Encrypt and TrustServerCertificate (TrustServerCertificate=True is refused, because it accepts any certificate), and refuses any other key by its name: a connection string never chooses how HostWebhook connects. Authentication is refused too: to sign in with Microsoft Entra, choose it in the form (step 02).
Named instances
A host written like SERVER\INSTANCE is refused. Give the instance a fixed TCP port (in SQL Server Configuration Manager) and write it here as host and Port, like 1433.
Sign in with Microsoft Entra (optional)
OptionalInstead of a SQL login, an Azure SQL Database or an Azure SQL Managed Instance can let HostWebhook in as an app of your own Microsoft Entra tenant. It also works when the server only accepts Microsoft Entra sign-in. It doesn't work with a server outside Azure, or with Amazon RDS. HostWebhook registers no app of its own: the app is yours, in your tenant.
Register an app only for HostWebhook.
Its secret can ask for a token for everything the app can do in your tenant, so don't reuse an app that does more. Register it for one organization only.
1. Register the app and create its secret. In the Microsoft Entra admin center, register an app for one organization only. On its Overview page copy the Directory (tenant) ID and the Application (client) ID. Under Certificates & secrets, create a client secret and write down when it expires: 24 months at most, and Microsoft recommends less than 12. Copy the secret's Value, the column called Value, not the Secret ID.
- Marker 1: Application (client) ID, on the app's Overview page.
- Marker 2: Directory (tenant) ID, on the same page.
- Marker 1: The Client secrets tab of Certificates & secrets.
- Marker 2: New client secret: give it a name and an expiry date.
- Marker 3: The secret you created, with its Expires date and its Value. Copy the Value, not the Secret ID, when you create it: Microsoft shows it once.
2. Save the app in HostWebhook. Under Sign in with, choose Microsoft Entra service principal. The Microsoft Entra app picker lists the Microsoft Entra apps of your organization you can use. Pick yours, or click Create new next to it and fill in the Tenant ID, the Client ID and the Client secret. The secret is encrypted and never comes back to the panel. The SQL Server credential keeps only which app you picked.
- Marker 1: Sign in with: Microsoft Entra service principal. The user and the password give way to the app.
- Marker 2: Host and Port: the host has to end in
.database.windows.net. The Database is needed too, below them. - Marker 3: Microsoft Entra app: the app you saved. The same app also works for the Microsoft Entra ID node. If its Microsoft Graph permissions are delicate, register another app only for SQL Server.
- Marker 4: TLS: Strict or Required. Microsoft Entra needs the certificate checked and a direct connection, with no tunnel.
3. Make the app a user of the database. A Microsoft Entra admin of the server, signed in with Microsoft Entra (the query editor of the Azure portal, or SSMS), runs this in the database. The admin is the one set on the server: in the Azure portal, open your SQL server, then Settings and Microsoft Entra ID. Use the name of the app you registered:
CREATE USER [hostwebhook-app] FROM EXTERNAL PROVIDER; GRANT SELECT, INSERT, UPDATE ON dbo.orders TO [hostwebhook-app]; GRANT EXECUTE ON dbo.usp_create_order TO [hostwebhook-app];
The app doesn't need API permissions or Azure roles: what it can do is what those GRANTs say. It has to be in the same tenant as the server.
- Marker 1: Admin name: the Microsoft Entra admin of the server, the one who can run
CREATE USER … FROM EXTERNAL PROVIDER. - Marker 2: Support only Microsoft Entra authentication for this server: turn it on only if nobody needs a SQL login. With it on, every SQL login is refused, administrators included, and the credential has to use Microsoft Entra service principal.
Click Save SQL Server connection and then Test connection. With Microsoft Entra, the test first asks for a new token, and if that fails it shows the reason without connecting.
What Microsoft Entra needs, and the secret's life
- Only Azure hosts. The host has to end in
.database.windows.net, the certificate is checked (Strict or Required) with the public roots, and no tunnel: the token only goes straight to Azure. Anything else is refused when you save, so a token can't be sent to another server. - Changing the host or the app asks you to pick the app again, and only someone who can use that app can. So whoever edits the SQL Server credential but not the app can't send its token to another server.
- The secret expires. Create a new one before it does and save it in the Microsoft Entra app, with Edit keys and settings (step 10).
- If you delete the client secret in Microsoft Entra, SQL Server connections can keep signing in with the token HostWebhook already holds (up to about an hour) until Microsoft is asked again, which happens as soon as anything is refused (a Test, or a connection without a saved token); from then on they stop with "Microsoft Entra rejected the client secret…" and you reconnect with the new Value.
- A token lives only in memory. It's never written to a log, an error or a run.
Reach a private database (optional)
OptionalHostWebhook only connects to public hosts: localhost and private addresses are refused. For a SQL Server on your own network, a virtual network or a machine on your desk, run the tunnel agent next to it and leave it running:
npm install -g hostwh hostwh login hostwh expose-tcp --target localhost:1433 --id my-sqlserver
- Marker 1: How do we reach it: pick your tunnel. It has to say ONLINE.
- Marker 2: There's no IP to allow: your agent connects from inside your network.
- Marker 3: Host: the one of your agent's
--target, usuallylocalhost. - Marker 4: Port: the one of your agent's
--target, usually1433.
User and Password are still needed: the tunnel moves the bytes, it doesn't log you in. Under TLS, choose Strict or Required and paste your server's CA (or pick the RDS shortcut): the certificate is checked against the Host you type, so start the agent with the name the certificate carries as its --target (for example --target sql01.example.local:1433) and type the same name as the Host, not localhost. Microsoft Entra doesn't go through a tunnel (step 02).
Putting, changing or removing a tunnel asks for the password again, because the tunnel decides where the password goes.
Read rows
In Flows, add a SQL Server node and open it. Pick your credential, choose Single operation under Mode, and open Operation.
| Operation | What it does |
|---|---|
| Get rows | The rows of a table that match the filters, in the order you pick |
| Insert rows | Adds one or more rows to a table, and gives back what it inserted |
| Update rows | Changes the columns you pick in every row that matches the filters |
| Upsert rows | Adds rows, or updates the ones that already exist with the same primary key |
| Delete rows | Deletes every row that matches the filters |
| Execute stored procedure | Calls a procedure with typed parameters (step 06) |
| Run SQL | Runs a SQL batch of your own (step 06) |
Get rows is the one to start with. Run it to see your data.
- Marker 1: Schema: pick it from the list HostWebhook reads from your server. Empty means
dbo. Above it, Database works the same way: empty means the credential's, and on Azure SQL it is always the credential's. - Marker 2: Table: pick it from the list of that schema.
- Marker 3: Columns (optional): the ones you want back. Empty means all.
- Marker 4: Filters (optional): only rows that match all of them. Here,
statusequalsnew. - Marker 5: The output:
rowsandrowCount.
Filters are a list, not SQL: =, !=, >, >=, <, <=, LIKE, IN, IS NULL and IS NOT NULL. A read gives back up to 1,000 rows, 100 by default.
Numbers that could lose digits come back as text, so they never change on the way: bigint, decimal, numeric, money and uniqueidentifier, like "total": "120.50". Dates and times (datetime2, datetimeoffset, time) come as ISO text, and binary columns as base64.
The node after it runs once per row, and that row is its payload: use {{payload.status}}.
Change rows
Insert rows and Upsert rows take Rows: one JSON object per row, like {"email": "ana@example.com", "total": 120}, up to 500. Identity, calculated and rowversion columns are not written: a value for an identity column is refused.
Update rows and Delete rows need at least one filter, so they never touch the whole table by accident. Both run in a transaction, and give back the rows only if everything went well.
- Marker 1: Table: the table whose rows change.
- Marker 2: Filters: at least one. Here,
idequals{{payload.id}}, a value from the event (after a SQL Server trigger,{{payload.row.id}}). - Marker 3: Values: only the columns you change, as a JSON object, like
{"status": "paid"}.
Insert, Update, Upsert, Delete, Execute stored procedure and Run SQL change your database.
Run really adds, changes or deletes the rows. Try a filter with Get rows first to see which rows it matches.
Update, Upsert and Delete need a table with a primary key. Otherwise the node says This table has no primary key, so HostWebhook can't tell its rows apart. Use Run SQL.
Call a stored procedure or run your own SQL
Execute stored procedure calls a procedure by name, with typed parameters. Pick the Database, the Schema and the Procedure from the list of the ones your user can run, and write the values as a JSON object, like {"order_id": 7}. A parameter you leave out isn't sent, so its default applies.
- Marker 1: Procedure: the ones your user is allowed to run.
- Marker 2: Parameters: a JSON object. HostWebhook reads the type of each one from your database, so no SQL is built from your values.
- Marker 3: The output:
returnValue,outputParametersandresultSets, up to 5.
The procedure decides what it changes.
It can touch anything its code reaches, even what the user can't touch directly. Give EXECUTE only on the procedures a flow calls.
Run SQL is for what the others can't do: joins, schema changes and anything else. It runs the whole batch you write. Values in {{ }} are sent safely, as parameters, like SELECT * FROM dbo.orders WHERE id = {{payload.id}}. Write them outside quotes. The SQL is what you wrote in the node, never something that came in the payload.
Every call has a deadline (10 seconds by default). When it passes, the statement is cancelled.
Start a flow when a row is added, changed or deleted
SQL Server can also start a flow. Add a Trigger node, choose SQL Server as its service, pick your credential, the Schema and the Table. The table needs a primary key. A SQL Server database can't call a URL by itself, so HostWebhook checks the table on a timer, with a plain SELECT, and starts the flow once for each row. It creates nothing in your database.
Pick a Mode: how the trigger sees changes.
| Mode | Works on | Events |
|---|---|---|
| By column | Any table. Nothing to turn on in your database | New rows, Updated rows. Deleted rows aren't seen |
| Change Tracking | A table that has Change Tracking turned on, which your DBA does once | New rows, Updated rows and Deleted rows |
By column watches a column, the cursor:
- Marker 1: Mode: By column. It works on any table.
- Marker 2: Event Trigger: New rows or Updated rows. Pick one.
- Marker 3: Cursor: here, a
rowversioncolumn, which SQL Server moves on every insert and update. The panel proposes it if the table has one. - Marker 4: Creation column (optional): when the row was created, usually
created_at. A row touched within 2 seconds of being created doesn't count as changed. - Marker 5: Ignore changes made by this flow: on, so the rows your own flow writes don't start it again.
| Event | When it fires | Cursor |
|---|---|---|
| New rows | A row with an identity id or a creation date above the last one seen | An identity column, or created_at |
| Updated rows | A row whose rowversion or change date moved past the last one seen. A row touched within 2 seconds of being created doesn't count as changed | A rowversion column, or a date your app sets on every edit, usually updated_at |
For New rows, any other whole-number column needs Only my app sets this id: whoever can insert can pick that value, and a huge one would leave the trigger deaf. Put an index on the cursor: without one, every check reads the whole table, and the trigger says so.
Time zone of this date appears when the cursor is a datetime2, datetime or smalldatetime. Choose Server time zone if the database fills it, like DEFAULT SYSDATETIME(), and UTC if your app does. With Not sure, rows can arrive hours late, but none are lost. A wrong pick can miss rows. A datetimeoffset carries its own zone.
Change Tracking is a feature of SQL Server that records which rows changed. It works in every edition, Express included, and in Azure SQL. A DBA turns it on once, for the database and for the table:
ALTER DATABASE shop SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 2 DAYS, AUTO_CLEANUP = ON); ALTER TABLE dbo.orders ENABLE CHANGE_TRACKING; ALTER DATABASE shop SET ALLOW_SNAPSHOT_ISOLATION ON;
The last line is optional and recommended. The user needs SELECT and VIEW CHANGE TRACKING on the table:
GRANT VIEW CHANGE TRACKING ON dbo.orders TO hostwebhook;
- Marker 1: Mode: Change Tracking. The table has to have it turned on.
- Marker 2: Event Trigger: Deleted rows. The row is gone, so only its key is known, and filters can't be used with this event.
- Marker 3: Ignore changes made by this flow: on, so the rows your own flow writes don't start it again.
- Marker 4: Check every, in seconds: how often it checks. Your plan sets the minimum.
When everything is set, click Activate. A trigger needs at least one connected node. Activating starts from now: the rows that were already there don't fire it. HostWebhook checks the table every 5 minutes unless you choose otherwise (as often as every minute on a paid plan, every 15 minutes on the Free plan). Rows per check goes up to 500.
Test push shows the latest rows it would pick up. Nothing is sent and your flow doesn't run.
A check every few minutes keeps serverless databases awake.
The free tier of Azure SQL Database pauses after 15 minutes without activity, and a trigger that checks every 1 to 5 minutes keeps it on, and spends its monthly allowance. Pick a longer interval for a database you want to pause.
Deleted rows need Change Tracking.
By column can't see a deletion. To react to one without Change Tracking, mark the row instead of deleting it, with a deleted_at column your app sets along with updated_at, and watch Updated rows.
Use what arrives
Everything the trigger sends is in payload, so the nodes after it can use it from the start. In By column:
{
"event": "row.updated",
"database": "shop",
"schema": "dbo",
"table": "orders",
"row": { "id": 1042, "status": "paid", "total": "59.97" },
"cursor": "0x00000000000007D1"
}event is row.created for New rows and row.updated for Updated rows. database is the database the trigger picked, and null when it uses the credential's. The columns keep the types of step 04: an int is a number, and bigint, decimal, numeric, money and uniqueidentifier are text, like "total": "59.97". Use the columns like {{payload.row.status}}. The most common flow is a SQL Server node after the trigger: Update rows with the filter id equals {{payload.row.id}} to mark the row as handled.
In Change Tracking, event can also be row.deleted, and the payload adds the operation, the key and the version. A deleted row has no row:
{
"event": "row.deleted",
"database": "shop",
"schema": "dbo",
"table": "orders",
"operation": "delete",
"key": { "id": 1042 },
"row": null,
"version": "132"
}The key has the same types as the columns: a number for an int id, like 1042. Use {{payload.key.id}} for a deleted row.
Run SQL can start the flow again.
Ignore changes made by this flow is on by default. It covers the changes this flow's SQL Server nodes make, like Update rows. SQL Server doesn't say which rows Run SQL changed, so the trigger may fire on them.
Let an AI node use SQL Server (optional)
OptionalIn step 04, choose AI toolkit instead of Single operation. The node has 9 tools, such as select_sqlserver_rows and update_sqlserver_rows, and four of them start blocked. Add the others to an AI node from its Tools: Add Tool, then From Workspace.
- Marker 1: Tables the AI can use: only these. Empty means none. One per line, like
dbo.orders. - Marker 2: Procedures the AI can use: only these, and only if you turn on
execute_sqlserver_procedure. Empty means none. - Marker 3: The blocked tools: a blocked tool can't be used here by any AI node or MCP server.
Four tools start blocked.
delete_sqlserver_rows, query_sqlserver, execute_sqlserver_sql and execute_sqlserver_procedure. Turn one on only if the agent should do that. query_sqlserver and execute_sqlserver_sql aren't limited by the list of tables: they reach whatever the database user can, and SQL Server has no read-only mode for a session, so a statement that changes data will change it. If you turn on query_sqlserver, give it a credential of its own whose user only has db_datareader.
The AI gets up to 200 rows per read and adds up to 100 per insert. The rows of your tables can say anything, so a model can still be fooled by them, even though they are data, not instructions: block the tools it doesn't need.
If a flow uses AI (the AI node, Hermes or Claude), the rows it reads or changes go to that AI.
Reconnect after a password or secret change
If the password changes in your database, the nodes fail with SQL Server rejected the user or password. Reconnect the credential. and the triggers of that credential pause at their next check.
- Marker 1: The credential is marked Needs reconnect.
- Marker 2: The warning says what happened, here that the server rejected the login (SQL Server error 18456). Its Reconnect opens Edit keys and settings.
- Marker 3: Edit keys and settings, also in the Keys and settings card further down. You verify it's you first.
The form you connected with opens, filled in with what the credential has. Type the new password and click Save, and the nodes work at once. If you can't see the keys of the credential, the password box comes empty: an empty password keeps the one it has, but a new server or tunnel needs it typed again.
With Microsoft Entra, a secret that expired or isn't right pauses the credential the same way, with The client secret has expired. Create a new one in Microsoft Entra and reconnect. or Microsoft Entra rejected the client secret. Paste its Value, not its ID, and reconnect. Create a new secret, open Edit keys and settings on the Microsoft Entra app and paste its Value. Every SQL Server credential that uses the app works again.
Then click Activate on each paused trigger: it stays paused until then. It continues where it stopped, so the changes made in between still arrive.
To disconnect SQL Server for good, delete the credential in Settings, Credentials, and delete its user in your database.
Troubleshooting
The certificate couldn't be checked. Paste your server's CA (step 01). A tunnel doesn't skip the check: it only lets you use the name the certificate carries as the Host (step 03). HostWebhook always checks the certificate: there is no mode that skips the check.
This connection skips the check of the server's certificate. A credential saved before with Required, no check isn't deleted, but it stops connecting and says so. Change it to Required, with the CA, in Edit keys and settings (step 10).
The server won't encrypt the connection, so HostWebhook didn't send the password. The server has to accept an encrypted connection. On RDS, rds.force_ssl is a static parameter: the instance needs a restart to apply it.
Couldn't reach the SQL Server. Check the host and the port, and that your server or provider allows HostWebhook's IP. On Azure SQL Database, the connection policy of the server decides how a client reaches a node: with Proxy everything goes through port 1433, and with Redirect the gateway sends the client to another node of Azure SQL. HostWebhook follows that redirect only to another Azure SQL address, once, and never through a tunnel; any other redirect is refused before it connects.
Named instances aren't supported yet. Give the instance a fixed TCP port and use it here, like 1433.
This server only accepts Microsoft Entra sign-in. The credential signs in with a SQL login, and the server has Support only Microsoft Entra authentication turned on, so it refuses every SQL login: a new password never fixes it. Switch the credential to Microsoft Entra service principal (step 02), or turn that option off in the Azure portal. Then click Activate on each trigger that paused with this line.
The app signed in, but this database has no user for it. Run CREATE USER [your-app] FROM EXTERNAL PROVIDER in the database, as in step 02. Sometimes the line adds or it can't connect: the user is there but has no permission to connect, so run GRANT CONNECT for it too.
Microsoft Entra can't find the client ID or the tenant. Check both IDs on the app's Overview page. If Microsoft Entra says the app is disabled, or that a Conditional Access policy blocked the sign-in, ask your Microsoft Entra admin.
Azure SQL is busy or paused. HostWebhook tries again by itself. A serverless Azure SQL database that has been idle pauses itself, and its first connection wakes it up, usually in less than a minute. The test, which doesn't try again by itself, says Azure SQL is busy or paused. If it was paused, it is waking up: try the Test again in a minute. A node that runs while it wakes can time out: run it again after a minute. Turning a trigger on at that moment fails with a line that says to click Activate again in a minute: nothing is checked again until the trigger is on.
Table dbo.orders doesn't exist, or the database can't be opened with this user. Pick another table in the node, or check what the user can reach.
The trigger paused. Its card says why. If a table or a column it watches isn't there anymore, pick it again. If Change tracking was turned off on this table, turn it on again (step 07). If Change tracking no longer has the changes since the last check, its retention ran out, or the table was truncated while changes were still waiting to be sent: click Activate. It starts again from now, and the card says that what changed in between is not sent. Pick a retention longer than the longest your flow could be off. After five failed checks in a row, fix the cause and click Activate.
A TRUNCATE sends no deleted rows. Change Tracking doesn't record it: with the trigger up to date, emptying a table with TRUNCATE TABLE produces no event and no warning, and the rows are simply gone. If you need each row reported as deleted, delete them with DELETE.
A new row takes up to a minute to arrive. A date cursor is compared with the database's clock minus a minute, so a transaction that is still open isn't skipped.
Nothing connects through the tunnel. Check that the agent is running and that the tunnel says ONLINE. Run only one agent per tunnel.
Microsoft, SQL Server and Microsoft Entra are trademarks of the Microsoft group of companies.