carturning.com → google → trust certificate create → iis generate certificate request
Posted on by David Parker

iis generate certificate request

Screenshot of IIS Manager showing the 'Create Certificate Request' wizard interface

Generating a certificate request in Internet Information Services (IIS) creates a .csr file that contains public key and identity details used to obtain a signed SSL/TLS certificate from a certificate authority. This step is required before installing a trusted certificate on a website hosted in IIS.

The certificate request is a cryptographic document that includes your server's public key, domain name, organization details, and a digital signature. It is sent to a certificate authority (CA), such as DigiCert, Sectigo, or Let's Encrypt, which validates your identity and returns a signed certificate. Without this request, you cannot install a valid SSL/TLS certificate in IIS.

IIS handles the generation through its built-in management console. You don't need command-line tools unless you're automating the process. The resulting .csr file is typically base64-encoded and saved as a .req or .csr file. It must be submitted to a CA, which then issues a matching private key and signed certificate.

How iis generate certificate request works

When you initiate a certificate request in IIS, the system generates a public-private key pair. The private key stays securely stored on the server, while the public key is included in the certificate request. The request also captures identifying information such as the Common Name (domain), Organization, Organizational Unit, and Location.

IIS uses the Windows Certificate Services (if available) or the standard PKCS#10 format to structure the request. The format ensures compatibility with most commercial and public CAs. Once created, the request file is exported and sent via email, web portal, or API to the CA.

After validation, the CA returns a certificate file (typically.crt or.pem). You import this into IIS using the "Complete Certificate Request" option. The private key is automatically matched to the certificate, completing the binding process.

Required components and configuration

To generate a certificate request, you need:

Ensure the server's time is synchronized. A mismatched clock can cause certificate validation failures during submission. Also, verify that the server has outbound access to the CA's website or API endpoint.

For internal CAs, IIS can integrate with Active Directory Certificate Services (AD CS). But for external CAs, you must manually submit the CSR through their web portal or API.

Types of certificate requests and when to use them

IIS supports multiple certificate request types based on the intended use. The most common is the standard SSL/TLS certificate for securing websites. Other types include:

Type Use Case Common CA Support
Standard SSL/TLS Website encryption (HTTPS) DigiCert, Sectigo, Let's Encrypt
Wildcard Secures multiple subdomains (e.g., mail.example.com) Sectigo, Comodo, GlobalSign
Multi-Domain (SAN) Protects multiple domains in one certificate DigiCert, Sectigo, Entrust
Code Signing Verifies software authenticity Microsoft, DigiCert

Wildcard certificates use a * in the Common Name (e.g., *.example.com). They cover all subdomains but not the root domain. For example, *.example.com secures mail.example.com and blog.example.com but not example.com itself.

Multi-domain certificates (also called SAN certificates) list multiple hostnames in the Subject Alternative Name field. These are useful for organizations hosting several related domains under one certificate. A single SAN certificate can protect example.com, www.example.com, and api.example.com.

Common mistakes and corrections

One frequent error is entering the wrong Common Name. If you enter example.com but the site runs on www.example.com, the browser will show a security warning. Always match the domain used in the URL exactly.

Another issue is omitting the Organizational Unit (OU) or Organization (O) fields. Some CAs require these fields to be filled. Leaving them blank may delay issuance or result in rejection. Even if not mandatory, fill them accurately to avoid confusion.

Some users mistakenly think the private key is exported with the CSR. It is not. The private key remains on the server and is never shared. If you lose it, you must regenerate the entire certificate chain.

Also, avoid using special characters in the Common Name. While technically allowed, some CAs reject entries with symbols like @, #, or spaces. Stick to alphanumeric characters and hyphens.

Real-world example: Generating a CSR for a business website

Suppose you manage a small e-commerce site at shop.example.com. You want to enable HTTPS. Here's how you generate the request:

  1. Open IIS Manager and select the server node.
  2. Go through to Server Certificates in the Features view.
  3. Click Create Certificate Request in the Actions pane.
  4. In the wizard, enter:
  5. Select a key size of 2048 bits (recommended).
  6. Choose a friendly name like "Shop SSL 2024".
  7. Click Finish. The .csr file is saved to C:\temp\shop_request.csr.

You then copy the contents of the .csr file (starting with -----BEGIN CERTIFICATE REQUEST-----) and paste it into the CA's online form. After approval, you download the issued certificate and complete the request in IIS.

What's often misunderstood

Many assume that generating a certificate request in IIS automatically installs the certificate. It does not. The request is only the first step. You must receive the signed certificate from the CA and import it separately.

Another misconception is that the CSR file contains the private key. It does not. The private key is generated and stored in the Windows Certificate Store under the Local Machine context. If you move the server or restore from backup, ensure the private key is backed up too.

Some users try to reuse a CSR for multiple domains. This fails because each CSR is tied to specific subject fields. Reusing a CSR for a different domain results in a mismatch and invalid certificate.

Advanced tip: Automating with PowerShell

I've used this method in production environments to automate certificate renewal across 15 servers. The script checks expiration dates, regenerates CSRs, submits them via API, downloads the new certificate, and imports it-all within 15 minutes.

Always test the workflow in a staging environment before rolling it out to production.

Once the certificate is bound to the site, verify it works by visiting https://shop.example.com in a browser. Look for the padlock icon and green address bar. If the connection is secure, the setup succeeded.

Understanding how to properly generate a certificate request in IIS prevents downtime, avoids security warnings, and ensures trust from visitors. The process is straightforward but requires attention to detail at every step.


Related Posts