ARM 对 Azure WebApp 的 IP 限制(Azure 资源管理器)

IP Restriction on Azure WebApp from ARM (Azure Resource Manager)

我正在使用 ARM 模板部署到 Azure Web Apps,站点部署到许多环境,ARM 模板为每个环境接受不同的参数。

其中一项要求是在某些环境中而非其他环境中在站点上启用 IP 块。这可以通过 web.config 完成,但这并不理想,因为我通过 ARM 管理所有应用程序设置并执行压缩站点的网络部署。为每个环境添加转换会很痛苦,并且需要大量返工。

我想在我的模板文件中指定这样的内容:

   {
      "type": "config",
      "apiVersion": "2015-08-01",
      "name": "web",
      "properties": {
        "ipSecurityRestrictions": {
          "allowUnlisted": false,
          "ipAddresses": [ "127.0.0.1", "127.0.0.2" ]
        }
      },
      "dependsOn": [
        "[concat('Microsoft.Web/sites/', parameters('nameofwebapp'))]"
      ]
    }

使用 resources.azure.com 浏览 "Microsoft/Web" 的资源提供者,这似乎是可能的,因为 "config/web" 上有 "ipSecurityRestrictions" 属性。

ARMView

ARM Explorer 代码显示了它 here 并提示了它的用法。我还可以在此处的 .netSDK 中找到它过去的用法(运行 超出允许的链接)。

当我尝试使用 resources.azure.com 进行设置时,我没有得到任何反馈,并且 returns 为空。

任何人都可以帮助详细说明如何使用这个 属性 吗?

该设置是针对允许的 IP 地址而不是排除 - 您可以通过 https://resources.azure.com/

进行设置

用法示例是:

"ipSecurityRestrictions": [
  {
    "ipAddress": "12.23.254.3",
    "subnetMask": "255.255.0.0"
  }
]

我不得不添加 siteConfig 并将 ipSecurityRestrictions 放在那里以使其工作:

{
    "apiVersion": "2015-06-01",
    "name": "[parameters('siteName')]",
    "type": "Microsoft.Web/Sites",
    ...
    "properties":{
        "siteConfig":{
            "ipSecurityRestrictions" : {
                 "ipAddress": "123.123.123.123"
            }
        }
    },
    "resources" : {
        ...
    }
}