Azure CloudService Deployment "Keyset does not exist"

Deploy Azure cloudservice failed, and Microsoft Azure Activity Log shows the following message:

15:45:39 - Checking for Remote Desktop certificate...  
15:45:40 - Applying Diagnostics extension.  
15:46:03 - Applying remote desktop protocol (RDP) extension.  
15:46:03 - Keyset does not exist.

It seems that the problem is caused by the certificate which is used to encrypt the user credentials of RDP.

First, I found the corresponding certificate in ServiceConfiguration.Cloud.cscfg (hiding the thumbprint):

<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="XXXXX" thumbprintAlgorithm="sha1" />

If the certificate is not installed, the error message should be:

16:59:15 - Applying Diagnostics extension.
16:59:40 - Applying remote desktop protocol (RDP) extension.
16:59:40 - Certificate with thumbprint XXXX doesn't exist.

However, I checked the certificate by certmgr.msc and found it in personalfolder.

Looks weird.

Just have a try, delete it, re-import the certificate, and redeploy the cloudservice, it works!