0

嗨我无法连接到Microsoft Azure管理库中的API。 我能够检索管理证书,但没使用Azure管理libraries.It的抛出下面的错误..Azure .NET管理库 - 列出所有托管服务,未通过身份验证 -

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
 

 
<html> 
 

 
<head> 
 

 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
 

 
<title>Certificate Verification Error</title> 
 

 
<link rel="stylesheet" href="https://management.core.windows.net/%24%24%24%26%3f%26%3f%24%24%24?cmd=get_file&arg=block_style.css&sid=E782F60E376DB9012C327F2100408E7E60DCD746" type="text/css"> 
 

 
</head> 
 

 
<body> 
 

 

 

 
<div id="pagecontainer"> 
 

 
     <img class="icon" src="https://management.core.windows.net/%24%24%24%26%3f%26%3f%24%24%24?cmd=get_file&arg=images/block.png&sid=208AEF2DE8AE073BAE795A5F34C2451B3487847E"> <!--Icon for block type--> 
 

 
     <h1>A certificate verification error occured</h1> 
 

 

 

 
     <div class="row"> 
 

 
       <p class="label">Overview:</p> 
 

 
       <p class="item">The access to the URL management.core.windows.net is restricted because the validation of the certificate failed</p> 
 

 
     </div> 
 

 
     <div class="row"> 
 

 
       <p class="label">Details:</p> 
 

 
       <p class="item"><b><i>VERIFY DENY: depth=0</i></b>, Client Certificate requested: "management.core.windows.net"</p> 
 

 
     </div> 
 

 

 

 
     <div id="options"> 
 

 
       <p class="label">Options:</p> 
 

 
           
 

 
       <form action=""><input type="button" class="button" onclick="history.back();" value=" Go Back "></form><p class="item">Pressing the button allows you to go to the previous page.</p> 
 

 
           <p class="last-item">To find out more about the reason for the block message, please contact your administrator and refer to ID 29.</p> 
 

 
     </div> 
 

 

 

 
     <div><img class="logo" title="Websense" src="https://management.core.windows.net/%24%24%24%26%3f%26%3f%24%24%24?cmd=get_file&arg=images/wslogo_block_page.png&sid=2C58FBA3B0156FEAD2B6B3E804A651DDB1B26800" alt="Websense Logo"> 
 

 
       <div style="clear: both; overflow: hidden; height:1px;"></div> 
 

 
     </div> 
 

 
</div> 
 

 

 

 
</body> 
 

 
</html>

请找到下面的代码片段,我用列出我的Azure订阅下的服务。

using (var client = new ComputeManagementClient(
    new CertificateCloudCredentials(subscriptionId, 
     new X509Certificate2(Convert.FromBase64String(base64))) 
    )) 
      { 
       var result = client.HostedServices.List(); 
       result.ToList().ForEach(x => Console.WriteLine(x.ServiceName)); 
      } 

回答

0

确保base64包含证书的私钥(不是来自.CER文件的私钥)。 此外,请确保公钥(.CER文件)以正确的订阅ID上传到您的Azure管理证书区域

+0

谢谢gorek,后来我发现了这个问题。这是因为防火墙阻塞了。禁用代理后,它工作:) – Neel

相关问题