Difference between revisions of "SSL SAN Self Signed Certificate Creation in PowerShell"

From Logic Wiki
Jump to: navigation, search
(Created page with "Category:SSL Category:Powershell <pre> $cert = New-SelfSignedCertificate -DnsName "server.docker.local", "localhost", "host.docker.internal" -CertStoreLocation cert:\...")
 
Line 1: Line 1:
 
[[Category:SSL]]
 
[[Category:SSL]]
 
[[Category:Powershell]]
 
[[Category:Powershell]]
 +
 +
Open '''powershell''' as '''administrator'''
  
 
<pre>
 
<pre>

Revision as of 09:34, 10 November 2021


Open powershell as administrator

$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()