0

您好,我无法连接到 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>

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

1 回答 1

0

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

于 2015-10-08T15:54:33.180 回答