在ARM模板部署我需要添加SQL Server上的防火墙例外在同一个模板中定义Azure的应用程序服务的出站IP地址功能的使用:引用()在资源的copy.count(Azure的RM模板)
{
"name": "[concat(variables('sqlServerName'),'/azureFireWallRule',copyIndex())]",
"type": "Microsoft.Sql/servers/firewallRules",
"apiVersion": "2014-04-01",
"properties": {
"startIpAddress": "[split(reference(variables('appServiceRef')).possibleOutboundIpAddresses,',')[copyIndex()]]",
"endIpAddress": "[split(reference(variables('appServiceRef')).possibleOutboundIpAddresses,',')[copyIndex()]]"
},
"copy": {
"name": "[concat(variables('sqlServerName'),'azureFireWallRule')]",
"count": "[length(split(reference(variables('appServiceRef')).possibleOutboundIpAddresses,','))]"
},
"dependsOn": [
"[variables('sqlServerRef')]",
"[variables('appServiceRef')]"
]
}
但是不允许在copy.count中使用reference()函数。
我试图解决这个(不是没有运气):具有嵌套部署资源通过IP数作为paramater
- 使用条件属性
OFC,问题可能是通过2次连续部署解决。但是有没有一种方法可以通过单个ARM模板来实现?
如果您[请检查Azure网络应用的** possibleOutboundIpAddresses **或** outboundIpAddresses **](http://ruslany.net/2015/06/how-to-find-out-outbound-ip-addresses -used-azure-web-app /),你可以发现它通常包含4个出站IP地址。所以你可以尝试直接设置“count”为4。 –
这并非总是如此。我有5-6 possibleOutbounIpAddresses有时 –