Lone Badger Tech

Connection settings

TLS, any SqlClient keyword, and SSH tunnels.

TLS

tls:
  mode: strict                       # default | optional | mandatory | strict (TDS 8.0)
  hostNameInCertificate: myapp.database.windows.net
  serverCertificate: certs/sql01.cer # pin the server certificate
  trustServerCertificate: false      # true only for local development

Any SqlClient setting

connectionProperties accepts every keyword SqlClient understands and applies them last, over everything else. Invalid keywords or values are reported by bsm doctor and before connecting.

connectionProperties:
  Connect Retry Count: 3
  Connect Retry Interval: 10
  Connect Timeout: 30
  Command Timeout: 120
  ApplicationIntent: ReadWrite
  Multi Subnet Failover: true
  Failover Partner: sql02
  Server SPN: MSSQLSvc/sql01.corp.contoso.com:1433
  IP Address Preference: IPv4First
  Max Pool Size: 10
  Application Name: release-pipeline

Common Azure SQL choices: Connect Retry Count and Connect Retry Interval for transient faults, Multi Subnet Failover for failover groups, tls.mode: strict where supported.

SSH tunnels

Reach a database behind a bastion host. Badger SQL Migrate opens a local port forward and connects through it; TLS is still validated against the real server name.

ssh:
  host: bastion.example.com
  port: 22
  user: deploy
  privateKeyFile: ~/.ssh/id_ed25519
  privateKeyPassphrase: ${env:SSH_KEY_PASSPHRASE}
  # password: ${env:SSH_PASSWORD}
  # knownHostsFile: ~/.ssh/known_hosts          (default)
  # hostKeyFingerprint: SHA256:abc...           (pin instead of known_hosts)

The bastion's host key must be in known_hosts (ssh-keyscan bastion.example.com >> ~/.ssh/known_hosts) or pinned with hostKeyFingerprint. insecureSkipHostKeyCheck: true exists for throwaway environments and prints a warning every time.

Overriding for one run

--connection-string "..." connects exactly there, replacing the environment's host, port and database; authentication and other settings still apply.