How to Create a Certificate for a Role
Updated: September 12, 2011
You may need different types of certificates depending on the type of application that you develop for Windows Azure. For example, you might have a need for the following:
-
Creating an X.509 certificate. An X.509 v3 certificate is used to authenticate operations with a Windows Azure subscription. An X.509 v3 server certificate can also be used for testing web based services. The format of this certificate uses a .cer extension. In Windows Azure, this type of certificate is uploaded as a management certificate and is used by a VM role.
-
Creating a Personal Information Exchange certificate. A Personal Information Exchange certificate that is issued by a signing authority and verifies the authenticity and security of the hosted service (can be a self-signed certificate for testing purposes). The format of this certificate uses a .pfx extension. This type of certificate is used as a service certificate and is needed for creating a remote desktop connection.
-
Obtaining the thumbprint for a certificate. The thumbprint is used to identify the certificate for authenticating operations performed in a hosted service.
For more information about certificate usage in Windows Azure, see Managing Certificates in Windows Azure.
You can use the Certificate Creation Tool (makecert.exe) to create an X.509 certificate for a management certificate:
-
Open the Visual Studio Command Prompt window as an administrator.
-
Change the directory to location where you want to save the certificate file.
-
Type the following command:
makecert -sky exchange -r -n "CN=<CertificateName>" -pe -a sha1 -len 2048 -ss My "<CertificateName>.cer"
Where <CertificateName> is the name that you want to use for the certificate. It must have a .cer extension. For more information about using the tool, see Certificate Creation Tool (Makecert.exe).
You can also use the Internet Information Services (IIS) Manager to create an X.509 server certificate. For more information about using IIS Manager to create certificates, see Create a Self-Signed Server Certificate in IIS 7
-
Open the Internet Information Services (IIS) Manager by typing inetmgr in the Start menu textbox.
-
In the IIS section of the center pane, double-click Server Certificates.
-
Click Create Self-Signed Certificate, and then finish the wizard.
You can use the Certificate Manager to export a Personal Information Exchange formatted certificate. You can also export this format from the Internet Information Services (IIS) Manager. When you export the certificate to the .pfx format, you must know the password for the private key. For more information about importing and exporting certificates, see Import or export certificates and private keys.
-
Open the Certificate Manager snap-in for the management console by typing certmgr.msc in the Start menu textbox.
-
If you used the procedure that includes using the makecert program to create a certificate, the new certificate was automatically added to the personal certificate store. If your certificate is not listed under Personal Certificates, import your X.509 certificate.
-
Export the certificate by right-clicking the certificate in the right pane, pointing to All Tasks, and then clicking Export.
-
On the Export Private Key page, ensure that you select Yes, export the private key.
-
Finish the wizard.
If you are using Internet Information Services (IIS) Manager to manage certificates, you can export a .pfx formatted version.
-
Open the Internet Information Services (IIS) Manager by typing inetmgr in the Start menu textbox.
-
In the IIS section of the center pane, double-click Server Certificates.
-
Right-click the certificate in the center pane, and then click Export.
-
Select the location for the file, enter the name for the file, and enter the password for the private key.
-
Click Ok.
If you need to use a remote desktop connection to access your role instance, you must ensure that you encrypt the password that is associated with the user account. To encrypt the password, a service certificate is required. You can use the CSUpload Command-Line Tool to upload an existing certificate or you can use the CSEncrypt Command-Line Tool to create a certificate and then encrypt a password for a remote desktop connection.
The thumbprint of the certificate is required for some operations involved with service authentication. You can obtain the thumbprint of a certificate by using the Certificate Manager or the Internet Information Services (IIS) Manager.
-
Open the Certificate Manager snap-in for the management console by typing certmgr.msc in the Start menu textbox.
-
Ensure that your certificate has been imported.
-
Expand Personal, click Certificates, right-click the certificate in the list, and then click Open.
-
Click Details, and then locate the Thumbprint property and value in the list.
Note The thumbprint in Certificate Manager contains spaces and lowercase characters. You must remove the spaces and convert the characters to uppercase when using the thumbprint in the service model or when encrypting a password for a remote desktop connection.
-
Open the Internet Information Services (IIS) Manager by typing inetmgr in the Start menu textbox.
-
In the IIS section of the center pane, double-click Server Certificates.
-
Select the certificate in the center pane, and then click View in the Actions pane.
-
Click Details, and then locate the Thumbprint property and value in the list.
See Also
- 5/6/2011
- Jonathan Gao
The first '-' character in the command string is not being published as the correct character. An en-dash character is being inserted instead of a minus sign. To run the makecert command, copy the command string to the command prompt window and then change the first dash to a minus sign, change the certificate information, and then run the command. We are working on a fix for this issue.
- 1/3/2011
- David Murray - Microsoft
- 1/30/2011
- Thomas Lee
- 11/30/2010
- Michael Epprecht [MSFT]
- 1/30/2011
- Thomas Lee
