Helping you solve those tough coding problems!

Creating a Windows Self-Signed SSL Certificate for use with IIS Creating a Windows Self-Signed SSL Certificate for use with IIS

Published on Apr 12, 2019 by Jamie Munro

I recently showed how to setup an SSL certificate using nginx, in this article I will demonstrate how to create a Self-Signed SSL certificate that can be used with IIS.




Creating the SSL certificate



I am going to leverage Powershell to help create the certificate. Start by opening Powershell in Administrator mode. Next run the following code to create the certificate:


New-SelfSignedCertificate -DnsName endyourif.local -CertStoreLocation cert:\LocalMachine\My


This will create a certificate for the domain named endyourif.local.

Now we need to move the certificate from Personal to Trusted. To do this I will use the Certificate Manager. Expand the folder called Personal and select Certificates. Find the newly created certificate and drag it from the Personal folder to Trusted Root Certification Authorities -> Certificates folder.

Next I will export the certificate so I can import it into IIS.

Right-click the certificate and choose All Tasks -> Export. Select Yes to Export Private Key. Check Export all extended properties. Under security choose your local user. Finally click Next and choose a location to save it to.

Import the SSL certificate into IIS



Now it's time to import the certificate into the IIS website. Open IIS Manager. Under Features open Server Certificates and import the newly created key.

And finally let's associate the certificate with the website. Select the website you want to enable SSL on. Select Bindings and Select 443. From the drop-down select the SSL certificate that you just added. Click OK and restart the IIS website. Now, in my case, I can open endyourif.local with https.

Tags: ASP.NET | ssl

My Books
ASP.NET MVC 5 With Bootstrap and Knockout.js
Knockout.js Building Dynamic Client-Side Applications
20 Recipes for Programming MVC 3
20 Recipes for Programming PhoneGap
Rapid Application Development with CakePHP