Recently I ran into a problem with using Certificates to upload my project to Windows Azure. I was doing something wrong over and over again, so I thought I’d post the correct way of doing it. It’s something I’ve done many times, but on setting up a new computer I had to do it again for the first time in a while and ran into a brick wall. If you get the same error it will read like:
When you want to upload to Azure, for security Visual Studio Tools for Windows Azure require the use of a certificate. You must enter a certificate before you can upload your project with the Visual Studio Tools.
Select from the Credentials drop down the option to <Add> a new Credential:
Now you can select or create a certificate for use with these credentials:
You will see any existing certificates in this list, mine has a few – yours may be empty. However for this example we will create a new Certificate, so select <Create> and enter a friendly name:
Now you will be taken back to the Windows Azure Project Management Authentication screen with the certificate selected. Now you must open up the Management Portal at http://windows.azure.com and upload the newly created certificate to the Portal. The shortcut to doing this is to click the first and then second link at point 2 of the below dialog:
In the portal, make sure you go to the Management Certificates section. This was where I was going wrong! I was adding a certificate to a Hosted Service rather than the overall Management Portal.
Click the Add Certificate button at the top left of the screen, select the subscription to use and browse to the certificate in this location:
Clicking “Done” will create the certificate, and then you will be able to upload your project to Windows Azure.
How not to do it!
Just to be clear, I was adding my certificate to the wrong place:
This Certificates Node is used to manage a particular instance set, for things such as Remote Desktop.
It’s pretty easy to go wrong, but easy to notice that you have once you know what to look for – make sure your certificate upload dialog doesn’t contain a Password field! This is because the certificate for upload and a certificate for remote desktop are different (the remote desktop contains the private key):
Had I been a little more awake, I probably would have thought in more depth about why I didn’t know what the password was! However, if you specify a .cer file in here, the portal doesn’t need to use it, and so won’t mind that you just made it up! Trying to use this will result in the error message:
If you run into this issue, just delete the certificate from within your Hosted Services subscription and instead add it to the Management Certificates part of the Portal.
Also, it’s probably time to get another coffee It certainly was for me!
As I was writing this, there was an update by David Hardin on a very similar subject: http://blogs.msdn.com/b/davidhardin/archive/2011/01/18/azure-ssl-verses-management-api-certificates.aspx