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

law*_*per 9 asp.net azure azure-resource-manager azure-web-app-service

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

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

我想在我的模板文件中指定类似的内容:

   {
      "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'))]"
      ]
    }
Run Code Online (Sandbox Code Playgroud)

使用resources.azure.com浏览资源提供程序"Microsoft/Web"时,似乎这可能是因为"config/web"上存在"ipSecurityRestrictions"属性.

ARMView

ARM Explorer代码在此处显示,并提示其用法.我也可以在.netSDK中找到它的过去使用情况(用完链接).

当我尝试使用resources.azure.com设置它时,我得不到任何反馈,它返回为null.

任何人都可以帮助我详细了解如何使用这个属性?

Jam*_*e D 11

该设置适用于允许的IP地址而非排除项 - 您可以通过https://resources.azure.com/进行设置

用法示例是:

"ipSecurityRestrictions": [
  {
    "ipAddress": "12.23.254.3",
    "subnetMask": "255.255.0.0"
  }
]
Run Code Online (Sandbox Code Playgroud)

  • 您也可以为此使用参数,这里是一组 IP 地址的示例,允许作为数组参数 { "name": "web", "type": "config", "apiVersion": "2015-08 -01", "dependsOn": [ "[resourceId('Microsoft.Web/sites', parameters('webSiteName'))]" ], "tags": { "displayName": "Allowed IPs" }, "properties" : { "ipSecurityRestrictions": "[parameters('ipRangesPermitted')]" } } 把这个放在Wesite的'resources'下 (2认同)

Lar*_*lie 6

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

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