When we develop web-application or experiment with some technologies it’s quite common to need a certificate. A certificate for real world scenarios can be expensive and it’s over-engineering for testing purposes. So with this simple PowerShell script (on Windows) we can create a self-signed certificate for development enviroments.
$cert = New-SelfSignedCertificate -DnsName mydemowebapp.net -CertStoreLocation cert:\LocalMachine\My $pwd = ConvertTo-SecureString -String "MyPassword" -Force -AsPlainText Export-PfxCertificate -Cert $cert -FilePath C:\temp\cert.pfx -Password $pwd
With these few line of codes we create and store a self-signed certificate in the Windows Certificate Store. With the last line (Export-PfxCertificate) we export the certificate for furher use for example to do some experiments with cloud providers.