You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to process template language expressions for resource '/subscriptions/746ac5b9-70eb-4c76-bdf4-0664bfdff2ea/resourceGroups/GRP-EU-IFM-SMA-RG12/providers/Microsoft.Web/sites/aziedt1xvu284/config/web' at line '155' and column '9'. 'The template function 'copyIndex' is not expected at this location. The function can only be used in a resource with copy specified.
it looks like there is something unusual about how copy is working with the config resource type. I suspect it has to do with the config properties also being available on the sites resources. If you move the config setting up to the sites resources, instead of as a sub-resource, it works correctly.
Hi Team,
Seems CopyIndex for property looping is not working again.
Followed below MSDN docs
https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-multiple#property-iteration
similar issue was reported back in 2017
#2
Error
Unable to process template language expressions for resource '/subscriptions/746ac5b9-70eb-4c76-bdf4-0664bfdff2ea/resourceGroups/GRP-EU-IFM-SMA-RG12/providers/Microsoft.Web/sites/aziedt1xvu284/config/web' at line '155' and column '9'. 'The template function 'copyIndex' is not expected at this location. The function can only be used in a resource with copy specified.
Parameter
"allowedCallerIpAddresses": {
"type": "array",
"defaultValue": [
{ "addressRange": "52.232.252.175/32" },
{ "addressRange": "52.236.71.198/32" },
{ "addressRange": "23.101.29.245/32" }
]
}
Resource Code
{
"apiVersion": "2018-02-01",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('functionsHost'))]",
"[resourceId('Microsoft.Web/sites/extensions', variables('functionsHost'), 'MSDeploy')]"
],
"name": "web",
"properties": {
"minTlsVersion": "1.2",
"copy": [
{
"name": "ipSecurityRestrictions",
"count": "[length(parameters('allowedCallerIpAddresses'))]",
"input": {
"ipAddress": "[parameters('allowedCallerIpAddresses')[copyIndex('ipSecurityRestrictions')].addressRange]",
"action": "Allow",
"tag": "Default",
"priority": "100",
"name": "[concat('APIM IPs-', copyIndex('ipSecurityRestrictions'))]",
"description": "Allowed APIM Access only"
}
}
]
},
"type": "config"
}
Note
ipSecurityRestrictions do work with single ip.
{
"type": "config",
"apiVersion": "2018-02-01",
"name": "web",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('functionsHost'))]",
"[resourceId('Microsoft.Web/sites/extensions', variables('functionsHost'), 'MSDeploy')]"
],
"properties": {
"minTlsVersion": "1.2",
"ipSecurityRestrictions": [
{
"ipAddress": "[parameters('allowedCallerIpAddresses')[0].addressRange]",
"action": "Allow",
"tag": "Default",
"priority": "100",
"name": "APIM IPs",
"description": "Allowed APIM Access only"
}
]
}
}
Thanks,
Subhash
The text was updated successfully, but these errors were encountered: