You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地SQL Server经VM1端口转发与Azure Data Factory连接故障求助

问题解决方案

背景概述

Windows 11虚拟机VM1通过VPN连接本地SQL Server,已配置端口转发命令:

netsh interface portproxy 
      add v4tov4 listenaddress=VM1_IP listenport=1433 
          connectaddress=SQL_SERVER_IP connectport=1433

同子网内VM2关闭防火墙并添加子网IP白名单后可正常连接数据库,但Azure Data Factory(配置同一子网私有端点)使用Azure运行时+SQL Server身份验证连接VM1失败,报错如下:

Cannot connect to SQL Database. Please contact SQL server team for further support. Server: 'vm1ip', Database: 'dbname', User: 'username'. Check the linked service configuration is correct, and make sure the SQL Database firewall allows the integration runtime to access.

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), SqlErrorNumber=53,Class=20,State=0,

The network path was not found

将VM1的1433端口暴露至公网后,Data Factory可正常连接。以下是针对性解决方案:


修复步骤

1. 调整VM1端口转发的监听地址

当前命令仅绑定VM1的私有子网IP,导致Azure集成运行时的流量无法匹配。修改为绑定所有可用IP:

netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=1433 connectaddress=SQL_SERVER_IP connectport=1433

随后删除原有绑定:

netsh interface portproxy delete v4tov4 listenaddress=原VM1_IP listenport=1433

2. 配置VM1防火墙的精准入站规则

确保Windows防火墙允许Azure集成运行时所在子网的IP范围访问1433端口:

  • 打开Windows Defender防火墙→高级设置→入站规则
  • 新建规则:选择「端口」→TCP→指定本地端口1433→允许连接
  • 在「作用域」选项卡中,将Azure集成运行时所在的子网IP段添加至「远程IP地址」允许列表

3. 确认Azure集成运行时的网络路由

  • 检查ADF私有端点是否正确关联到VM1所在子网,确保流量完全在私有网络内流转
  • 若使用Azure托管集成运行时,需确认其已配置为通过私有端点访问VM1,而非默认公网路由
  • 可在VM1上启用网络跟踪(netsh trace start capture=yes),验证是否有来自集成运行时的连接请求到达

4. 验证本地SQL Server的远程访问权限

  • 打开SQL Server配置管理器→SQL Server网络配置,启用TCP/IP协议
  • 在TCP/IP属性中确认监听端口为1433,且允许远程连接
  • 检查SQL Server登录账号是否拥有从VM1地址访问的权限(在SQL Server管理工具中配置登录账号的用户映射与服务器角色)

5. 检查VM1的VPN路由配置

  • 在VM1上执行route print,确认存在指向本地SQL Server网段的有效路由
  • 确保VPN连接的网络适配器优先级高于其他适配器,避免流量未走VPN通道

内容的提问来源于stack exchange,提问作者Sabin Kr Shrestha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 10:12:43