Created
September 30, 2021 00:43
-
-
Save ajomathew/659a893a3a941d72f824e0f703c13fda to your computer and use it in GitHub Desktop.
Azure ARM Copy Function with Objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"networkSecurityGroupsSettings": { | |
"type": "object" | |
} | |
}, | |
"resources": [ | |
{ | |
"apiVersion": "2020-11-01", | |
"type": "Microsoft.Network/networkSecurityGroups", | |
"name": "NSG1", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"copy": [ | |
{ | |
"name": "securityRules", | |
"count": "[length(parameters('networkSecurityGroupsSettings').securityRules)]", | |
"input": { | |
"name": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].name]", | |
"properties": { | |
"description": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].description]", | |
"priority": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].priority]", | |
"protocol": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].protocol]", | |
"sourcePortRange": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].sourcePortRange]", | |
"destinationPortRange": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].destinationPortRange]", | |
"sourceAddressPrefix": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].sourceAddressPrefix]", | |
"destinationAddressPrefix": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].destinationAddressPrefix]", | |
"access": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].access]", | |
"direction": "[parameters('networkSecurityGroupsSettings').securityRules[copyIndex('securityRules')].direction]" | |
} | |
} | |
} | |
] | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment