How to export certificates between Windows servers

How to export certificates between Windows servers

Transferring an SSL certificate from one Windows server to another involves exporting a PFX file from the server where the certificate is currently installed and importing it onto the destination server. Creating a PFX file is the sole method for moving the certificate along with its associated private key from a Windows server. Alongside the certificate and private key, a PFX file may also include intermediate certificates. This consolidates all certificate information (public and private keys) into a single, password-protected container.

Exporting a certificate from a Windows server can be accomplished either through Microsoft Management Console (MMC) or via IIS Manager if the certificate is already installed.

Export using MMC

1) Press Win+R, type in mmc and click OK to open Microsoft Management console:

2) Click File in the Menu Bar and then select Add/Remove Snap-in:

3) Select Certificates from the Available snap-ins field and click Add:

4) Choose Computer account:

5) Select Local Computer to manage the snap-in.

Note: To see the certificates in the local computer store, you should be logged in as Administrator.

6) Click OK to add the selected snap-in to the console window:

7) Go to the Personal >> Certificates store, right-click on the certificate you want to export, and select All Tasks >> Export:

8) When the Certificate Export Wizard opens, click Next to proceed:

9) When prompted, select Yes, export the private key and press Next:

If the Yes, export the private key option is not clickable, this means that the private key for the certificate is not exportable or is absent from the machine, and you will not be able to export a PFX file.

This may happen when the CSR code was created on a different server and the private key is not present on the current machine, or if the imported certificate was initially uploaded without the private key. To solve the issue you will need to generate a new CSR code with an exportable private key and reissue your certificate.

10) In the Export File Format dialogue window select Personal Information Exchange – PKCS #12 (.PFX) as the format you want to use. You may also check the Include all certificates in the certification path if possible option to place all intermediate certificates into the PFX file. Once done, click Next:

11) Specify the password for the PFX file and click Next.

This password is very important. Please remember it; this password will be required when importing a PFX file on a new server.

12) Specify the location and name of the file where PFX will be exported. Click Next:

13) To complete the wizard, click the Finish button. The certificate along with the private key has been successfully exported to the PFX file:

Export using IIS

1) Go to Start >> Administrative Tools >> Internet Information Services (IIS) Manager.

2) Select the server on which the certificate is installed.

3) Choose the Server Certificates option on the central menu:

4) Right-click on the needed certificate and select Export.

Only the certificates associated with private keys are shown in the list of server certificates in IIS Manager.

5) Specify the filename, location, and PFX export password and click OK:

A PFX file has now been exported and can be found in the specified location. Importing a certificate on a new server can be also performed by using either Microsoft Management Console or IIS Manager.

Import using MMC

1) Add the Certificates (Local Computer) snap-in to MMC by following the steps described above.

2) Once added, right-click on the Personal store >> All Tasks >> Import:

3) The Certificate Import Wizard will be launched, press Next:

4) Using the Browse button choose the .pfx file that you want to import to your server, press Next:

5) Enter the PFX file password that was specified during the creation of the .pfx file.

You may select Mark this key as exportable so that you can export the certificate with the private key from this server later. Then click Next:

6) In the next dialogue window, choose Automatically select the certificate store based on the type of certificate. This will allow MMC to place the certificates from the .pfx file in the corresponding folders if the file also contains intermediate certificates. Click Next:

7) Click Finish. The certificate has been imported to the server and can be now assigned to the website:

Once the certificate is imported, please keep in mind that the binding to a secured port has to be created for the website to use it.

1) To do this, select the Sites folder in the Connections panel on the left side of IIS Manager and click on the corresponding site. Then, in the Actions panel on the right side, select Bindings….

2) Click Add… on the right side of the Site Bindings window.

3) The next pop-up window will feature several fields that need to be modified:

  • Type – select “https” from the drop-down menu;
  • IP address – choose the specific IP address or “All Unassigned”;
  • Port – specify the port number for a secure connection. The default port number is 443;
  • SSL certificate – select the corresponding certificate, identified by the previously specified Friendly name.
  • Require Server Name Indication – please make sure to select this option in order for the server to use the proper certificate for the specific domain name. Do not use the same SSL for all the sites hosted on the server.

4) Click OK to bind the certificate with the site. The new entry should appear in the Site Bindings window.

Note: Usually, there is no need to restart the server, so after the SSL certificate has been installed and the binding created, your site should become accessible via https:// in a browser.

To check if the certificate has been successfully installed, you can use this tool.

Import PFX using IIS Manager

1) Launch Internet Information Services Manager (Start >> Administrative Tools >> Internet Information Services (IIS) Manager), and choose the server the certificate should be imported to.

2) Double-click Server Certificates in the central menu.

3) Click the Import button in the right-hand menu:

4) Locate the PFX file on your machine and specify the password that was used when exporting the certificate. Optionally, you may check Allow this certificate to be exported. Then, click OK:

Assigning a certificate to a website

Once the certificate has been imported by any of the methods described above, it will be shown in the list of server certificates in IIS Manager.

After that, please make sure to complete the binding of the certificate to a specific website.

You can find more information on how to bind the certificate to a website in IIS in this installation guide.