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

Visual Studio 2022 Azure资源组项目:添加资源与Schema版本疑问

问题解答

1. 能否添加Application Gateway、Network Security Group等资源

完全可以添加这些资源,不需要额外安装扩展或包。你只需要直接在azuredeploy.json模板文件中手动编写对应的资源定义即可:

  • 对于Network Security Group(NSG),资源类型为Microsoft.Network/networkSecurityGroups
  • 对于Application Gateway,资源类型为Microsoft.Network/applicationGateways

举个简单的NSG定义示例:

{
  "type": "Microsoft.Network/networkSecurityGroups",
  "apiVersion": "2023-09-01",
  "name": "[parameters('nsgName')]",
  "location": "[parameters('location')]",
  "properties": {
    "securityRules": [
      {
        "name": "Allow-HTTP-In",
        "properties": {
          "protocol": "Tcp",
          "sourcePortRange": "*",
          "destinationPortRange": "80",
          "sourceAddressPrefix": "*",
          "destinationAddressPrefix": "*",
          "access": "Allow",
          "priority": 100,
          "direction": "Inbound"
        }
      }
    ]
  }
}

Visual Studio的空白Azure资源组项目仅提供基础框架,所有Azure支持的资源都可通过手动编写ARM模板添加,无需依赖扩展包。

2. 为何项目使用2015版本的Schema

空白资源组项目默认使用旧版schema是因为Visual Studio的内置模板更新滞后。你可以手动将schema版本升级到最新稳定版,比如2023-09-01,只需修改模板文件顶部的$schema字段:

"$schema": "https://schema.management.azure.com/schemas/2023-09-01/deploymentTemplate.json#",

新版schema支持更多资源类型的最新特性,建议升级到与你所用资源API版本匹配的schema版本。


内容的提问来源于stack exchange,提问作者Cyril Damm

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.27 13:57:04