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

Terraform配置Azure自动化账户安装SqlServer模块包URL错误如何解决

解决方案

你当前配置存在两处错误,修正后即可正常部署:

  • 模块名称不匹配:你配置中name字段填写的xSqlServer是旧版SQL Server DSC模块的名称,若要安装官方PowerShell SqlServer模块,此处必须填写SqlServer,否则会触发元数据校验失败。
  • 模块下载地址格式错误:PowerShell Gallery的nupkg包下载需要走v2 API路径,不能直接使用前端浏览页面地址,正确的地址格式为https://www.powershellgallery.com/api/v2/package/<模块名>/<版本号>,无需手动添加.nupkg后缀。
正确配置示例
resource "azurerm_automation_module" "mod_sqlserver" {
  name                    = "SqlServer"
  resource_group_name     = module.aut_resourcegroup.rg.name
  automation_account_name = azurerm_automation_account.aut.name

  module_link {
    uri = "https://www.powershellgallery.com/api/v2/package/SqlServer/21.1.18256"
  }
}
额外注意事项
  • 如果需要安装最新版本的SqlServer模块,直接去掉uri末尾的版本号即可,地址写为https://www.powershellgallery.com/api/v2/package/SqlServer
  • 若你的Azure自动化账户配置了私有网络隔离,无法访问公网PowerShell Gallery,可手动下载对应版本nupkg包上传到同环境的Azure存储账户中,将uri替换为存储blob的带SAS权限的访问地址即可。

内容的提问来源于stack exchange,提问作者Harry Leboeuf

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.30 01:39:02