从C#Azure函数中访问证书

Hen*_*use 10 c# ssl azure azure-functions

我需要从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();
    }
Run Code Online (Sandbox Code Playgroud)

}

上传到Azure功能的两个证书和设置WEBSITE_LOAD_CERTIFICATES也被添加,并设置为*或所需证书的thumpbrint,但无济于事.

GetCertificate方法应该打印商店中所有证书的列表,但商店是空的.

关于如何解决这个问题的任何线索?

mat*_*ewc 6

我们的消费计划尚不支持客户端证书,仅在App Service计划中.这是一个问题,在我们的回购追踪这里.我们正在努力 - 请关注该问题的状态.谢谢.

  • 它现在应该在消费和应用服务计划中得到支持.我认为应该更新答案以反映这一点. (3认同)