SSL SAN Self Signed Certificate Creation in PowerShell
From Logic Wiki
Revision as of 09:33, 10 November 2021 by AliIybar (Talk | contribs) (Created page with "Category:SSL Category:Powershell <pre> $cert = New-SelfSignedCertificate -DnsName "server.docker.local", "localhost", "host.docker.internal" -CertStoreLocation cert:\...")
$cert = New-SelfSignedCertificate -DnsName "server.docker.local", "localhost", "host.docker.internal" -CertStoreLocation cert:\localmachine\my
#export it for docker container to pick up later
$password = ConvertTo-SecureString -String "Pa55w0rd!" -Force -AsPlainText
Export-PfxCertificate -Cert $cert -FilePath C:\https\aspnetapp.pfx -Password $password
# trust it on our host machine
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store "TrustedPublisher","LocalMachine"
$store.Open("ReadWrite")
$store.Add($cert)
$store.Close()