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

Azure自动化Runbook连接Azure SQL托管实例网络故障求助

Azure自动化Runbook连接Azure SQL托管实例网络故障排查

问题场景

通过Azure自动化账户Runbook中的PowerShell脚本查询Azure SQL托管实例时,出现网络层面的连接失败错误。

执行脚本

Connect-AzAccount -Identity
$Token = (Get-AzAccessToken -ResourceUrl https://database.windows.net).Token
Invoke-SqlCmd -Server "<hostname>" -AccessToken $Token -Query "select * from sys.databases"

已满足的前提条件

  • 使用PowerShell 5.1工作器
  • 自动化账户已安装SqlServer模块
  • 自动化账户配置了托管标识
  • SQL托管实例已为该托管标识创建SQL Server登录名

错误信息

Invoke-SqlCmd : 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 - A connection attempt failed because the
connected party did not properly respond after a period of time, or established connection failed because connected
host has failed to respond.)

环境配置细节

  • 目标为Azure SQL托管实例(非单数据库或虚拟机上的SQL Server)
  • SQL实例位于VNet/子网内,未启用公共访问
  • VNet网络安全组已配置允许TDS入站规则
  • 尝试过的网络配置:
    • 因目标子网已委派,无法在同一子网为Runbook创建专用终结点
    • 在同一VNet的不同子网创建Runbook专用终结点,未解决连接问题

排查进展(编辑补充)

  1. 基础IP连通性问题:SQL实例处于10.x.x.x网段的VNet中,Runbook执行Test-NetConnection查询实例主机名时,返回的SourceAddress为192.168.x.x,未使用Runbook专用终结点的10.x.x.x网段IP
  2. 使用Test-NetConnection -ConstrainSourceAddress <Runbook专用终结点IP>测试连接成功,确认需为Invoke-SqlCmd指定源地址

求助需求

恳请拥有Azure订阅的用户帮忙测试从Runbook查询SQL托管实例的基础场景,验证该场景的可行性及配置要点。


内容的提问来源于stack exchange,提问作者Seva Alekseyev

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.01 23:54:49