繁体   English   中英

从 Azure DevOps Pipeline 访问 SQL 服务器

[英]Accessing SQL Server from Azure DevOps Pipeline

问题

我已经设置了一个 Azure 管道,我遇到的问题是在管道的测试组件部分期间它失败了,因为它无法解析连接字符串/找到我的 SQL 服务器。

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception: The network path was not found

在这种情况下,我想避免创建模拟,理想情况下让代码直接与 SQL 服务器通信。

SQL 服务器位于 Azure VM 上,因此它不是“Azure SQL 数据库”服务。

我试过的

我已经打开了 Azure VM 上的端口,以允许来自 Azure DevOps 使用的所有区域/IP 范围的流量(我在网上发现这是必需的)。 我还尝试将管道“测试程序集”内的连接字符串指向不同的(本地)windows 服务器,该服务器包含 SQL 服务器的实例,但它仍然无法找到/连接到 Z9707840A014010CABCB828674010

从我的本地(Azure VM 和本地服务器)连接到 SQL 时,我可以连接。 我们还有一些其他服务使用 Azure VM 上的 SQL 服务器,因此我确信连接问题与从 Azure 管道连接有关。

以前有人遇到过这个问题吗?

更新

我已将连接字符串更新为直接引用端口,即

**.***.**.***,1433

并且错误消息现在已更改为:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.) ---> System.ComponentModel.Win32Exception: The wait operation timed out

我现在让它工作了。

在将 Azure DevOps 区域从西欧更改为英国南部后,我的 DevOps 现在可以与我的 VM 上的 SQL 服务器通信(具有所需的 ZA12A3079E14CED46E69BA52B8A90B21 注释)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM