从C#Azure功能中访问证书



我需要从我的Azure功能访问证书。

我遵循了Azure功能中运行时错误加载证书中概述的步骤,但没有奏效。

private static X509Certificate2 GetCertificate(string thumbprint, TraceWriter log)
{
    X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
    try
    {
        store.Open(OpenFlags.ReadOnly);
        log.Info("Enumerating certificates");
        foreach (var cert in store.Certificates) {
            log.Info(cert.Subject);
        }
        var col = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);
        if (col == null || col.Count == 0)
        {
            return null;
        }
        return col[0];
    }
    finally
    {
        store.Close();
    }

}

也添加了两个上传到Azure函数和设置网站的证书,也添加了 * load_certificates,并将其设置为 *或所需证书的thumpbrint,但无用。

GetCertificate方法应打印商店中所有证书的列表,但商店为空。

有关如何解决此问题的任何线索?

更新:现在在消费计划中支持客户端证书。

我们的消费计划中尚未支持客户端证书,仅在 App Service Service 计划中。我们在这里的回购中的问题跟踪了这一点。我们正在努力 - 请遵循该问题以获取状态。谢谢。

最新更新