How to create a self-signed certificate for a domain name for development

Using PowerShell

From Windows 8.1 and Windows Server 2012 R2 (Windows PowerShell 4.0) and upwards, you can create a self-signed certificate using the new New-SelfSignedCertificate cmdlet:

Examples:

New-SelfSignedCertificate -DnsName www.mydomain.example -CertStoreLocation cert:\LocalMachine\My

New-SelfSignedCertificate -DnsName subdomain.mydomain.example -CertStoreLocation cert:\LocalMachine\My

New-SelfSignedCertificate -DnsName *.mydomain.example -CertStoreLocation cert:\LocalMachine\My

Using the IIS Manager

Note that IIS certificates use SHA-1 hashing, which isn’t supported by modern browsers. IIS cannot create certificates using SHA-2 hashing options, thus it cannot create SSL certificates accepted by modern browsers.

  1. Launch the IIS Manager
  2. At the server level, under IIS, select Server Certificates
  3. On the right hand side under Actions select Create Self-Signed Certificate
  4. Where it says “Specify a friendly name for the certificate” type in an appropriate name for reference.
    • Examples: www.domain.example or subdomain.domain.example
  5. Then, select your website from the list on the left hand side
  6. On the right hand side under Actions select Bindings
  7. Add a new HTTPS binding and select the certificate you just created (if your certificate is a wildcard certificate you’ll need to specify a hostname)
  8. Click OK and test it out.

Leave a Comment