It should work out of the box, but it didn’t (for me).
It complained about the server certificate (java.security.cert.CertPathValidatorException: Algorithm constraints check failed on signature algorithm: SHA1withRSA
).
This is how I fixed it:
New-SelfSignedCertificate `
-Type SSLServerAuthentication `
-Subject "CN=$env:COMPUTERNAME" `
-FriendlyName "SQL Server Test self-signed" `
-DnsName "$env:COMPUTERNAME",'localhost.' `
-KeyAlgorithm RSA -KeyLength 2048 -Hash 'SHA256' `
-TextExtension '2.5.29.37={text}1.3.6.1.5.5.7.3.1' `
-NotAfter (Get-Date).AddMonths(240) `
-KeySpec KeyExchange `
-Provider "Microsoft RSA SChannel Cryptographic Provider" `
-CertStoreLocation "Cert:\LocalMachine\My"
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSQLServer\MSSQL13.GE\MSSQLServer\SuperSocketNetLib
(https://learn.microsoft.com/en-US/sql/database-engine/configure-windows/configure-sql-server-encryption?view=sql-server-ver16)keycloak.conf
: db-url=jdbc:sqlserver://sqlsrv;databaseName=<keycloakDB>;user=<keycloakUser>;password=s3cr3t;authentication=SqlPassword;trustServerCertificate=true;