Azure .NET管理库 - 列出所有托管服务,无法进行身份验证 -

时间:2015-10-08 14:21:03

标签: azure x509certificate2 azure-sdk-.net azure-management-api

您好我无法连接到Microsoft Azure管理库中的API。  我能够检索管理证书,但无法使用Azure管理库。它会抛出以下错误..



<!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>
&#13;
&#13;
&#13;

请在下面找到我用来列出我的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));
            }

1 个答案:

答案 0 :(得分:0)

确保base64包含证书的私钥(不是来自.CER文件的私钥)。 此外,请确保将公钥(.CER文件)上载到正确订阅ID

下的Azure管理证书区域