Unable to create a self signed Certificate for SQL Server 2017(14.x.xxxx) 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
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:

New-SelfSignedCertificate -Subject "CN=insert FQDN here" -DnsName "&lt;insert FQDN here&gt;","insert NetBIOS name here" -FriendlyName "Self Signed Certificate Friendly Name" -KeySpec KeyExchange -KeyLength 2048 -NotAfter (Get-Date).AddYears(5)


Please replace 'insert FQDN here' and 'insert NetBIOS name here' with the actual FQDN and NetBIOS name keeping the double quotes.