I ran into the same problem using the azure create cert link you provided. I learned that when creating a certificate using this method, the private key was not uploaded to the cloud service. Although the service was able to find the certificate, it was still unauthorized when sending requests.
. Visual Studio .cer .pfx:
makecert -r -pe -n "CN=AzureManage" -sky exchange "AzureManage.cer" -sv "AzureManage.pvk"
pvk2pfx -pvk "AzureManage.pvk" -spc "AzureManage.cer" -pfx "AzureManage.pfx" -pi password
. . pfx. -pi password , , .
:
- pfx / mmc.
- pfx Azure Cloud Service.
- Azure Management.
- pfx Azure.
API REST Azure :
X509Certificate2 GetCertificate(string thumbprint)
{
var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
var certs = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);
if (certs.Count == 0) return null;
var cert = certs[0];
store.Close();
return cert;
}
HttpWebRequest request = WebRequest.CreateHttp(apiUrl);
request.ClientCertificates.Add(cert);
request.Headers.Add("x-ms-version", "2012-03-01");