Menu

Generate a Self-signed Certificate for Azure

December 24, 2014 by Christopher Sherman

When creating an Azure Cloud Service, you may want to enable HTTPS for testing prior to obtaining a security certificate from a certificate authority. To do this, you can generate a self-signed certificate. Note that since the certificate is self-signed, it will generate a security warning in the browser and is generally not suitable for production.

To install a certificate using the steps below, you will need the Visual Studio Developer Command Prompt to execute the commands. Microsoft now offers Visual Studio for free.

  1. Run the Developer Command Prompt as Administrator
  2. Run the following command:
makecert -sky exchange -r -n "CN=" -pe -a sha1 -len 2048 -ss My ".cer"
  1. Run certmgr.msc
  2. Navigate to Certificates > Personal > Certificates
  3. Export the certificate matching the name you created in step two by right-clicking the certificate in the right pane, pointing to All Tasks, and then clicking Export
  4. On the Export Private Key page, ensure that you select Yes, export the private key
  5. Accept the default format (PFX) with Include all certificates... checked
  6. Set a password
  7. Note the location of the certificate and Finish the wizard
  8. Navigate to the Azure web portal
  9. Go to the certificate menu item on the service you’re uploading the certificate to
  10. Upload the certificate by navigating to the location where you saved the certificate in step seven
  11. Once completed, copy the thumbprint listed in the Azure web portal
  12. Open Visual Studio and double-click on the web role under the Cloud Service project
  13. Click Certificates
  14. Input the common name and thumbprint as reflected in the Azure web portal, leaving the Store Location as LocalMachine and the StoreName as My
  15. Save the solution
  16. Click Endpoints
  17. Add an endpoint with HTTPS in the name for clarity, select the protocol https, select port 443 and select the SSL Certificate Name matching the one you just created in Certificates
  18. Publish your project

You should now be able to navigate to the URL of your application via HTTPS.

Microsoft Azure