Created
August 25, 2025 16:05
-
-
Save tcartwright/5f529150e5fd686d80f442dae141f0c5 to your computer and use it in GitHub Desktop.
POWERSHELL: Generate a cert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IMPORTANT: !!Generated certs should NOT be used in production!! | |
$cert = New-SelfSignedCertificate ` | |
-Subject "CN=sso.servername.it" ` | |
-KeyAlgorithm RSA ` | |
-KeyLength 2048 ` | |
-CertStoreLocation "Cert:\CurrentUser\My" ` | |
-NotAfter (Get-Date).AddYears(5) ` | |
-KeyExportPolicy Exportable ` | |
-Type Custom ` | |
-TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3") # Code signing usage | |
$pwd = ConvertTo-SecureString -String "yourStrongPassword" -Force -AsPlainText | |
Export-PfxCertificate ` | |
-Cert "Cert:\CurrentUser\My\$($cert.Thumbprint)" ` | |
-FilePath "C:\sso.pfx" ` | |
-Password $pwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment