Azure 证书问题



我在Azure中创建了一个API应用服务。此 API 使用我通过该项目的 SSL 面板上传的 2 个证书安全地连接到另一个 API。所以这里有几件事:

1)我正在使用未启用SSL的免费试用版。但它允许我更改计划并上传它们。我想知道它们是否真的因为我的计划而被使用?

2)当我尝试根据其指纹查找其中一个证书时,找不到它,显然我无法连接到另一个API。

3) 我的域不安全,我没有 API 的证书,这是否不允许我连接到其他 API。

安装了这两个证书的本地环境一切都可以正常工作,但是我已经在这个问题上难住了几天了。任何帮助将不胜感激。

您需要

设置一个应用设置,其键为 WEBSITE_LOAD_CERTIFICATES,值包含:

  1. 要加载的指纹的逗号分隔指纹
  2. 或者只是一个星号 * 来加载所有这些

这将允许你的应用使用你上传的证书。

您可以在此处找到更多相关信息:https://azure.microsoft.com/en-us/blog/using-certificates-in-azure-websites-applications/

上面链接中的示例代码:

using System;
using System.Security.Cryptography.X509Certificates;
namespace UseCertificateInAzureWebsiteApp
{
  class Program
  {
    static void Main(string[] args)
    {
      X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
      certStore.Open(OpenFlags.ReadOnly);
      X509Certificate2Collection certCollection = certStore.Certificates.Find(
                                 X509FindType.FindByThumbprint,
                                 // Replace below with your cert's thumbprint
                                 “E661583E8FABEF4C0BEF694CBC41C28FB81CD870”,
                                 false);
      // Get the first cert with the thumbprint
      if (certCollection.Count > 0)
      {
        X509Certificate2 cert = certCollection[0];
        // Use certificate
        Console.WriteLine(cert.FriendlyName);
      }
      certStore.Close();
    }
  }
}

最新更新