There are multiple cases where you would need to have Certificates. The following are a few examples.
- To create or enable SSL on your custom domain for your Cloud applications.
- To enable Remote Desktop for your Virtual Machines.
You can either purchase the Certificates from third-party vendors (for production purposes) or create a Self-Signed certificate. For this example, we will look at how to create a Self-Signed certificate. In future articles, we will learn how to get a Certificate from third-party vendors, as well.
Open Visual Studio and navigate to your Cloud Service. Right click on the Cloud Service project and select “Configure Remote Desktop”, as shown below.
Visual studio will open the following popup where the “Enable Connections for all roles” checkbox is unchecked and so all the options are disabled by default.
Note: Please note that we are using Visual Studio just to create the .PFX (Personal Information Exchange) file. To understand the complete process of enabling Remote Desktop for a Cloud Service, please refer to my other article Azure Cloud Service – Enable Remote Desktop using Visual Studio.
As shown in the above screen, enable the “Enable connections for all roles” checkbox and open the dropdown with the text “<Automatic>” which displays all the certificates that you have already created. Select “<Create…>” to create a new one, as shown in the below popup.
Provide a friendly name for the certificate and click on “OK” button. It would take few seconds to create the Certificate.
Visual Studio has created and installed a Certificate in the local Certificate repository. Let’s navigate to the Certificate repository typing “certmgr.msc” in the run command (Windows + R), as shown below.
Clicking on “OK” button will open the Certificate Manager.
Select “Personal -> Certificates” to open the Self-signed certificates where you can see the one that you have just created using Visual Studio.
Azure Management portal expects a .PFX file. Let’s generate a .PFX file using the selected Certificate in the above screenshot.
Right click on the Certificate name, select “All Tasks”, and then choose “Export”. It opens a “Certificate Export Wizard”, as shown below.
Clicking “Next” will take you to the next step.
In this step, choose “Yes, export the private key” option and click “Next”.
Let all the default options in the above screen be as-is and click on “Next”.
In this step, check the “Password” checkbox and provide and confirm the password. Please note this password somewhere safe. We need to provide this in the Azure Management portal while uploading the Certificate.
Click “Next” to go to the “File to Export” step, as shown below.
Provide a path along with the file name where you would like to save the .PFX file and click “Next” to go to the following step.
Now, clicking on Finish will show a confirmation message.
Now, you can view the .PFX file on the location you selected while exporting the file. Below is my .PFX file.
Let’s upload the .PFX file to Azure Management portal for our Cloud Service. Navigate to the Cloud Service and select “Certificates” blade, as shown below.
Click on “Upload” button to navigate to the “Upload Certificate” blade.
(In the above step, you need to provide the password that you have provided while exporting the .PFX file)
As soon as you select the .PFX file, the “Upload” button will be enabled. Click on “Upload” button to create the Certificate. After a few seconds, the Certificate gets created.
Summary- We have learnt the following,
- Creating a Self-signed Certificate.
- Exporting the Certificate to .PFX format along with a password key
- Uploading the .PFX file to Certificate Repository of the Cloud Service.
Hope you enjoyed reading the article. Your feedback will be highly appreciated.