Using SQL Server 2017 Developer Edition
The command I'm using is:
New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -DnsName host.doman.com -KeySpec KeyExchange -FriendlyName SQLCert
The error message is:
New-SelfSignedCertificate : A parameter cannot be found that matches parameter name 'KeySpec'.
My powerShell version is:
PS C:\Windows\system32> $PSversionTable Name Value ---- ----- PSVersion 4.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.42000 BuildVersion 6.3.9600.18773 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.2
Best Answer
You need to enclose CertStoreLocation, Subject, DnsName and FriendlyName with double quotes.
There is no need to specify a location as it will default to "Local Computer/Personal/Certificates" where it needs to be in order to use it by SQL Server.
This will generate a valid certificate on Windows Server 2016 that will be usable by SQL Server 2017:
Please replace 'insert FQDN here' and 'insert NetBIOS name here' with the actual FQDN and NetBIOS name keeping the double quotes.