azure - 如何在Azure Trusted Root Store for WebApp中安装第三方服务器的ssl证书?

标签 azure ssl-certificate mqtt webjob

我已在 Azure VM 上托管 Mosquitto 代理(MQTT 服务器)。我正在尝试通过 Azure WebJob 连接到 MQTT 代理。当我使用自签名服务器证书(ssl/tls 连接)从本地计算机连接到代理时,它工作正常,但是当我在 Azure AppService 上托管相同的应用程序时,它会给出错误:根据证书验证过程,远程证书无效。我已在 Azure 门户上安装了相同的 pfx 证书文件,但仍然收到相同的错误。如何在Azure可信根存储中安装第三方服务器的ssl证书,以便它可以通过可信根存储验证证书。

最佳答案

据我所知,我们没有权限在 Azure Trusted Root Store for WebApp 中安装第三方服务器的 ssl 证书。

我们只能从当前用户的存储中加载第三方服务器的证书。

如果服务器支持使用个人商店的SSL连接,我建议您可以尝试在azure门户中设置。

更多关于如何在Azure Web应用程序中加载证书的详细信息,您可以引用以下步骤:

1.上传证书:

enter image description here

2.复制指纹。

enter image description here

3.在应用设置中添加指纹,以便在网站运行时加载证书。

enter image description here

4.在webjobs函数中添加加载证书的代码:

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

结果:

enter image description here

关于azure - 如何在Azure Trusted Root Store for WebApp中安装第三方服务器的ssl证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44458088/

相关文章:

c# - 当使用当前时间格式化 DateTime 时,为什么会得到 2555 年?

c# - MVC Azure 中 OnActionExecuting 中 Controller 的实例化(...不抛出 404)

python - Python 上的 Azure Face API 中人脸验证的错误代码请求

message-queue - MQ 和 MQTT 有什么区别?

Python MQTT 连接到 Azure Iot Hub

mqtt - Paho MQTT 库名称

c# - 条目(数据库)已添加

python - Tornado https ssl 错误

ruby - 深度 0 处的 SSL 验证错误 : unable to get local issuer certificate (20)

java - 从 Java 程序到 mssql 的 SSL 连接