azure - 如何使用 Azure Function V2 管理签名证书

标签 azure ssl certificate azure-functions

我正在使用消费计划上的 Azure Functions 应用程序。 Func 应用程序需要加载特定的签名证书。

在本地计算机中,我将证书设置为个人证书,一切正常。

在 azure 上发布后,我收到此错误:

There are 0 certificates with the subject name cert.name in LocalMachine, MyUse scripts/certificates/ to generate this

关于如何将证书与 azure 函数一起使用,SO 甚至 Azure Func 文档都没有任何帮助。

有人有这方面的经验吗?

最佳答案

我明白了,而且非常简单。

首先转到 Function App 下的平台功能,您应该会找到 SSL,如下所示。

enter image description here

然后您可以根据需要添加公共(public)、私有(private)或 SSL 证书。就我而言,我想添加一个我已经导出的私有(private)证书并拥有它的私钥。

enter image description here

上传证书后,转到应用设置并添加此键/值:

WEBSITE_LOAD_CERTIFICATES: "Your Cert Thumbprint"

您应该能够使用此指纹加载证书,如下所示:

using System;
using System.Security.Cryptography.X509Certificates;

    ...
    X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
    certStore.Open(OpenFlags.ReadOnly);
    X509Certificate2Collection certCollection = certStore.Certificates.Find(
                                X509FindType.FindByThumbprint,
                                // Replace below with your certificate's thumbprint
                                "000000000000000000000000000000000000000",
                                false);
    // Get the first cert with the thumbprint
    if (certCollection.Count > 0)
    {
        X509Certificate2 cert = certCollection[0];
        // Use certificate
        Console.WriteLine(cert.FriendlyName);
    }
    certStore.Close();
    ...

关于azure - 如何使用 Azure Function V2 管理签名证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53778977/

相关文章:

azure - 如何使用 Azure EventGrid Webhook 维护幂等性?

python - 在 betfair.py 上调用 SSL

php - 如果我使用 php 获得 SSL 认证,如何为特定页面启用 https

ubuntu - 如何在 Azure Ubuntu 上保留主机名更改

c# - 应用程序抛出异常,web.config已被修改,但事实并非如此

azure - 控制台应用程序的应用程序洞察不起作用

python - 使用云上 Db2(仓库)的凭据来初始化 flask-sqlalchemy

java - Java客户端如何自动接受来自服务器的自签名证书

ssl - 在不影响安全性的情况下存储客户端 SSL 证书

certificate - 将证书添加到受信任的根权限