SQL Server Management Studio 从 Windows 10 连接到 Azure SQL 数据库,但未从 Windows Server 2012 上的 VM 连接

SQL Server Management Studio connects to Azure SQL Database from Windows 10 but does not connect from VM on Windows Server 2012

我使用完全相同的凭据和默认设置从我的 Windows Server 2012 R2 虚拟机连接到 Azure SQL 数据库,就像我在 Windows 笔记本电脑上使用的一样] 10. 我使用相同版本的 SQL Server Management Studio 2014.

我将两台机器的 IP 添加到 Azure SQL 数据库防火墙规则中。

VM 上的防火墙已关闭。

我的笔记本电脑与 Win10 完美连接,但每当我在带有 Windows 服务器的虚拟机上时,我的 SSMS 中都会收到此消息:

Connect to Server

Cannot connect to <my_database>.database.windows.net.


ADDITIONAL INFORMATION:

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 - No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)

如需帮助,请单击:http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=10061&LinkId=20476


No connection could be made because the target machine actively refused it


我应该怎么做才能使用 Windows 服务器从我的 VM 连接到该数据库?我在谷歌上搜索了很多,尝试了一些东西,比如为 TCP/UDP/ports 添加出站规则到 Windows 服务器防火墙,并在 SSMS 中尝试不同的协议,但我现在没有想法了。

此问题是由于缺乏从 VM 到 SQL Azure 的基本连接造成的。确保虚拟 NIC 卡映射到物理网卡(WIFI 或以太网)并且未配置 NAT、仅本地主机或专用网络。

This 文章可能有用。

希望对您有所帮助。

此致,

阿尔贝托·莫里洛

此问题已解决。问题是只有入站端口 1433 为该虚拟机打开。打开出站端口 1433 与我的 Azure 服务器连接后,一切正常。

我知道我在问题中写道 VM 上的防火墙已关闭,但我通过 wf.msc 命令获得了相关信息(有一个由系统管理员管理的更高级别的防火墙).