Powershell: New-SelfSignedCertificate not recognized on macOS

Created on 6 May 2017  路  9Comments  路  Source: PowerShell/PowerShell

My ASP.NET Core 1.1 project is intended to be used cross-platform. To help getting started with development of the website I'd like to include a PS script to setup the appropriate SSL certificate for development purpose.

For this scenario it would be perfect if I can use New-SelfSignedCertificate on both macOS and Windows, so that I don't need to deal with OpenSSL.

New-SelfSignedCertificate shipped first with Win2012 & Win8 releases of PowerShell. (MSDN link)

Steps to reproduce

Execute New-SelfSignedCertificate on macOS.

Expected behavior

Command to execute.

Actual behavior

> New-SelfSignedCertificate                             
New-SelfSignedCertificate : The term 'New-SelfSignedCertificate' is not recognized as the name of a cmdlet, function, s
cript file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is cor
rect and try again.
At line:1 char:1
+ New-SelfSignedCertificate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-SelfSignedCertificate:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Environment data

> $PSVersionTable

Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      6.0.0-alpha                                                                             
PSEdition                      Core                                                                                    
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   3.0.0.0                                                                                 
GitCommitId                    v6.0.0-alpha.18                                                                         
CLRVersion                                                                                                             
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1                                                                                 
Issue-Question Resolution-External

All 9 comments

The cmdlet is located in PKI module that is not part of the repo.

PKI module is owned by another team in Windows. Would be great to have a cross platform module for this cmdlet on the Gallery.

Thanks for the prompt responses! Is that other team aware of this, and is it possible to pass this feature request to them?

@bgever best thing to do is post a request on the Windows Server Uservoice

I think many MSFT teams and third party teams start once they get stable version of PoweShell Core. So welcome test and contribute in PowerShell Core today.

I haven't tested it yet, but this project looks promising and well-written:

https://github.com/rjmholt/SelfSignedCertificate

It is not a drop-in replacement for New-SelfSignedCertificate, but provides similar cert generation functionality using .NET Core native functionality. It doesn't store the generated certs in Windows cert storage.

@johncrim, that module was written by @rjmholt who is a member of the PowerShell Team. It is only intended for use by our tests that require a self-signed cert and not intended to be used in production. (Production systems generally should be using real-signed certs...)

@SteveL-MSFT but if it was to be used for LDAP, like shown in the tutorial here https://docs.microsoft.com/en-gb/azure/active-directory-domain-services/tutorial-configure-ldaps#create-a-certificate-for-secure-ldap, would then the module work as intended?

In this tutorial, you learn how to configure secure lightweight directory access protocol (LDAPS) for an Azure Active Directory Domain Services managed domain.

Actually no, is not the same, never mind...

Was this page helpful?
0 / 5 - 0 ratings