簡體   English   中英

Azure .NET管理庫-列出所有托管服務,但無法通過身份驗證-

[英]Azure .NET management libraries - List all hosted services, failed to authenticate -

您好,我無法連接到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));
            }

確保base64包含證書的私鑰(而不是來自.CER文件的私鑰)。 另外,請確保將公鑰(.CER文件)上傳到正確的訂閱ID下的Azure管理證書區域。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM