【问题标题】:How to install third party server's ssl certificate in Azure Trusted Root Store for WebApp?如何在 Azure Trusted Root Store for WebApp 中安装第三方服务器的 ssl 证书?
【发布时间】:2017-11-11 11:44:17
【问题描述】:

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

【问题讨论】:

    标签: azure ssl-certificate mqtt webjob


    【解决方案1】:

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

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

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

    更多关于如何在 azure web 应用中加载证书的详细信息,您可以参考以下步骤:

    1.上传证书:

    2.复制指纹。

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

    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);
        }
    

    结果:

    【讨论】:

    • 感谢您的快速回复。我已经尝试过这个选项,但仍然遇到同样的错误。
    • 我在stackoverflow.com/questions/44018848/… 上获得了一些有价值的信息。我想我需要购买真正的证书。自签名证书不适用于 Azure AppService/Webjob
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-08
    • 2013-02-25
    • 2021-06-22
    • 2018-03-17
    • 2021-10-21
    • 1970-01-01
    相关资源
    最近更新 更多