Three ways to a certificate
- Create a CSR in IIS: IIS Manager → server → Server Certificates → “Create Certificate Request”. Common name is the host name, bit length at least 2048. The text file goes to the CA.
- Import a PFX: if you already have certificate and key as a PFX (e.g. from another installation), use Server Certificates → “Import”.
- Let's Encrypt automatically: with win-acme (
wacs.exe) or Certify The Web. Both set up the binding and renewal.
Complete the request
Load the CA’s reply (.cer or .crt) under Server Certificates → “Complete Certificate Request”. Important: on the same server where the request was created. Only there is the private key.
If the certificate disappears from the list after completing, the link to the key is missing. This often helps:
certutil -repairstore my "<serial number of the certificate>"
Intermediate certificates
IIS serves the chain that Windows can build from the certificate store. If an intermediate is missing there, it is missing for the visitor too. Fix: import the CA’s intermediate with certlm.msc under Intermediate Certification Authorities and restart the service (iisreset). The SSL check shows whether the chain is right.
The HTTPS binding
- In IIS Manager select the site → Bindings → Add.
- Type https, port 443, enter the host name.
- Tick “Require Server Name Indication” (SNI) if several HTTPS sites run on the same IP. Otherwise one binding wins and other sites show the wrong certificate (ERR_CERT_COMMON_NAME_INVALID).
- Select the SSL certificate from the list.
With PowerShell
$pw = Read-Host -AsSecureString "PFX password" $cert = Import-PfxCertificate -FilePath C:\certs\server.pfx -CertStoreLocation Cert:\LocalMachine\My -Password $pw Import-Module WebAdministration New-WebBinding -Name "Default Web Site" -Protocol https -Port 443 -HostHeader www.example.com -SslFlags 1 (Get-WebBinding -Name "Default Web Site" -Protocol https -HostHeader www.example.com).AddSslCertificate($cert.Thumbprint, "My") netsh http show sslcert # shows all assignments
-SslFlags 1 enables SNI. If the certificate comes as PEM from a Linux system, convert it to PFX first, e.g. with the certificate converter or as in the article convert PFX and PEM.
Protocols and ciphers
IIS uses Windows’ TLS settings (Schannel). Windows Server 2022 and later support TLS 1.3. Switch off TLS 1.0 and 1.1 via the registry or conveniently with the IIS Crypto tool; its “Best Practices” template is enough. A reboot is required afterwards.
Typical problems
- Certificate does not appear in the binding list: it is in the user store instead of the computer store, or the private key is missing.
- “A specified logon session does not exist” when binding: the certificate was imported without key access. Reimport it into the computer store.
- Old certificate still served after renewal: the new certificate is installed, but the binding still points to the old one. Edit the binding, or let win-acme handle renewal.
FAQ
How do I export an IIS certificate for another server?
In IIS Manager under Server Certificates → Export, or in certlm.msc with “export the private key” and “include all certificates in the certification path”.
Do I need a separate IP for each site?
No. With SNI any number of HTTPS sites can share one IP. All current browsers support SNI.
Where do I set HSTS in IIS?
From IIS 10 (Windows Server 2019) directly in the site’s HSTS settings. On older versions as a custom response header.