azure - 将 Cosmos DB(作为服务端点)作为后端服务器与应用程序网关连接

标签 azure https azure-cosmosdb vnet

当前我想要将一个 Cosmos DB 实例(位于子网的服务端点后面)与应用程序网关实例(位于另一个子网后面)连接。

因此,我实现了从公共(public) IP 到 Cosmos DB 实例的 Https 转发。但是, azure 门户告诉我该数据库是一个不健康的后端服务,并表示该证书未列入白名单: enter image description here

这些是我迄今为止完成的步骤:

  1. 为从应用程序网关到 Cosmos DB 的连接创建 TLS 证书,其中公用名称 (FQDN) 等于概述中 Cosmos DB 实例的 URI (example.documents.azure.com):

$ openssl genrsa -out priv-key-db.pem 4096 $ openssl req -new -key priv-key-db.pem -out csr-db.pem $ openssl x509 -in csr-db.pem -out cert-db.cer -req -signkey priv-key-db.pem -days 365

  • 上传 .cer 文件,同时在 Azure 门户中创建适当的 http 规则: enter image description here
  • 最佳答案

    Azure Cosmos DB 是一项 Azure 托管服务。我们使用巴尔的摩 Cyber​​Trust Root 颁发的公共(public)证书通过 HTTPS 访问它。我认为当您通过应用程序网关访问数据库实例时,您无法为连接创建 TLS 证书,因为如果您想这样做,您还需要将 TLS 证书绑定(bind)到 Azure Cosmos DB服务,否则探测失败且后端未列入白名单。

    来自step 7 - 上传要在启用 SSL 的后端池资源上使用的证书。

    The default probe gets the public key from the default SSL binding on the back-end's IP address and compares the public key value it receives to the public key value you provide here.

    If you are using host headers and Server Name Indication (SNI) on the back end, the retrieved public key might not be the intended site to which traffic flows. If you're in doubt, visit https://127.0.0.1/ on the back-end servers to confirm which certificate is used for the default SSL binding. Use the public key from that request in this section. If you are using host-headers and SNI on HTTPS bindings and you do not receive a response and certificate from a manual browser request to https://127.0.0.1/ on the back-end servers, you must set up a default SSL binding on the them. If you do not do so, probes fail and the back end is not whitelisted.

    作为解决方法,您可以使用一些第三方代理服务器来帮助将 HTTPS 流量重定向到您的后端,例如 Nginx。希望这可以帮助您。

    关于azure - 将 Cosmos DB(作为服务端点)作为后端服务器与应用程序网关连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57187338/

    相关文章:

    azure - 更改服务级别或性能级别和数据库停机时间

    azure - 如何手动触发 azure 监控警报?

    http - 使用前导双斜杠继承 URL 中的协议(protocol)有什么缺点吗?即 src ="//domain.example"

    http - 仅为主页域从 HTTPS 重定向到 HTTP

    Azure 存储投票模式

    java - 尝试将 Azure 政府端点与 Azure 存储 Java 库一起使用时出错

    c# - 从 cosmos 数据库按时间获取最新记录时出现问题

    azure - cosmos 中的多个 order by

    javascript - 将 localStorage 数据从 HTTP 迁移到 HTTPS

    docker - 从 Linux docker 访问本地机器上的 Cosmos db 模拟器