Setup SSL Certificate for MSSQL

From DevOps Notebook
Revision as of 10:37, 31 January 2023 by MilosZ (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1. Generate certificate on windows server

New-SelfSignedCertificate -Type SSLServerAuthentication -Subject "CN=$env:COMPUTERNAME.$env:USERDNSDOMAIN" -DnsName "$env:COMPUTERNAME.$env:USERDNSDOMAIN",'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(120) -KeySpec KeyExchange -Provider "Microsoft RSA SChannel Cryptographic Provider"

2. Check user that runs MSSQL from Services and add permissions to certlm.msc / Personal / Certificates / <newcert> / Manage Private Keys

3. Go to Sql Server Configuration Manager and under SQL Server Network Configuration / Protocols for MSSQLSERVER add Certificate

4. Restart MSSQL service