SQL Database

The SQL Database platform connects Polysync to Azure SQL Database, Azure SQL Managed Instance, and SQL Server (on-premises or IaaS) so it can execute stored procedures as scheduled Jobs. It uses the modern Microsoft.Data.SqlClient driver.

Required attributes

  • Server Name — the SQL server host. Examples: myserver.database.windows.net (Azure SQL), sqlhost, sqlhost\INSTANCE, or sqlhost,1433 (SQL Server with an explicit port).
  • Database Name — the initial catalog (database) to connect to.

Optional connection attributes

  • Encrypt Connectiontrue (default) / false. Controls TLS encryption of the connection. Leave enabled for Azure SQL.
  • Trust Server Certificatetrue / false (default). Set to true to accept a self-signed / untrusted server certificate — common for on-premises SQL Server in dev/test. Leave false for Azure SQL (which presents a trusted certificate).
  • Connection Timeout (Seconds) — how long to wait when opening the connection.
  • Command Timeout (Seconds) — how long to wait for the stored procedure to complete. Increase this for long-running procedures.

Accepted boolean values for Encrypt Connection / Trust Server Certificate: true/false, 1/0, yes/no.

Authentication methods

  • Polysync Service Principal(recommended, Azure SQL) — no extra attributes. Polysync acquires an Entra ID access token from the centrally-managed Polysync identity (https://database.windows.net/.default) and assigns it to the connection. Map the identity as a database user (see below). Secret-less.
  • SQL AuthenticationUsername + Password. Works for both Azure SQL and SQL Server. Store the password in a Secret Vault and rotate it regularly.
  • Service Principal (Azure SQL)Tenant Id, Client Id, Client Secret. Uses an Entra application mapped to a database user.
  • Certificate (Azure SQL)Tenant Id, Client Id, Certificate (base64 or thumbprint), optional Certificate Password. More secure than a client secret.

Permissions checklist

  • Entra methods (Azure SQL) — create a contained database user for the identity and grant it execute rights, e.g.:

    CREATE USER [polysync-app] FROM EXTERNAL PROVIDER;
    GRANT EXECUTE TO [polysync-app];      -- or GRANT EXECUTE ON SCHEMA::dbo
    GRANT VIEW DEFINITION TO [polysync-app]; -- enables parameter discovery
    
  • SQL Authentication — the login needs EXECUTE on the target procedures and VIEW DEFINITION (for parameter discovery and typed output binding).

  • VIEW DEFINITION is required for full parameter discovery and for reading OUTPUT parameter values back. Without it, Polysync falls back to sending the supplied values as untyped input parameters (input-only procedures still run).

Job discovery

Test connectivity first, then import Jobs. Discovery queries sys.procedures (joined to sys.schemas) for every non-system stored procedure, and sys.parameters for each procedure's parameters. Each parameter is imported as a Job parameter with a Direction derived from its SQL mode:

  • an input parameter → Input
  • an OUTPUT parameter → Input & Output (T-SQL output parameters are bidirectional; the caller may seed a value and the procedure writes one back)

You can adjust the Direction of any parameter in the Job editor after import.

Execution model

Stored procedures run synchronously — the run completes during the call, so there is no separate polling phase, and there is no external "run" page to link to. See the job page for the full execution flow and parameter binding rules.

Supported jobs

  • SQL Stored Procedure — executes a stored procedure, binding input parameters and reading OUTPUT parameters and the return code back into the run output.

Troubleshooting

Symptom Likely cause Fix
Login failed for user (18456) Wrong SQL credentials, or the Entra identity is not a database user Verify the login/password or run CREATE USER ... FROM EXTERNAL PROVIDER and grant rights
Cannot open database (4060/40615) Database name wrong, or the firewall blocks the caller Check Database Name; add the Polysync egress IP to the Azure SQL firewall
Connection times out (network) Wrong Server Name/port, or the server is unreachable Confirm host/port and network path; increase Connection Timeout
TLS / certificate error on SQL Server Self-signed server certificate not trusted Set Trust Server Certificate = true (dev/test) or install a trusted certificate
Parameters not discovered / outputs empty Missing VIEW DEFINITION Grant VIEW DEFINITION to the identity
Procedure runs long then fails Command Timeout too low Increase Command Timeout (Seconds)