Skip to main content

Microsoft SQL Server

Required extra

This connection requires the sqlserver extra. See Installation.

Test data in MS SQL Server, including Azure SQL, Synapse Analytics SQL Pool, and Microsoft Fabric.

Server

servers:
- server: production
type: sqlserver
host: localhost
port: 5432
database: tempdb
schema: dbo
driver: ODBC Driver 18 for SQL Server

Environment variables

VariableExampleDescription
DATACONTRACT_SQLSERVER_AUTHENTICATIONsqlsql (default), cli (uses az login), windows, ActiveDirectoryPassword, ActiveDirectoryServicePrincipal, ActiveDirectoryInteractive
DATACONTRACT_SQLSERVER_USERNAMErootUsername (for sql, ActiveDirectoryPassword, ActiveDirectoryInteractive)
DATACONTRACT_SQLSERVER_PASSWORDtoorPassword (for sql and ActiveDirectoryPassword)
DATACONTRACT_SQLSERVER_CLIENT_IDa3cf5d29-...Client ID (for ActiveDirectoryServicePrincipal)
DATACONTRACT_SQLSERVER_CLIENT_SECRETkX9~Qr2Lm...Client secret (for ActiveDirectoryServicePrincipal)
DATACONTRACT_SQLSERVER_TRUST_SERVER_CERTIFICATETrueTrust self-signed certificate
DATACONTRACT_SQLSERVER_ENCRYPTED_CONNECTIONTrueUse SSL
DATACONTRACT_SQLSERVER_DRIVERODBC Driver 18 for SQL ServerODBC driver name

The cli mode reuses an az login session through the Azure default credential chain and requires ODBC Driver 18.1 or newer.