Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save chgeuer/e749bb76df3800110ca76b404990b4f0 to your computer and use it in GitHub Desktop.

Select an option

Save chgeuer/e749bb76df3800110ca76b404990b4f0 to your computer and use it in GitHub Desktop.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {
"nsgName": "nsg",
"numberOfASGs": 130,
"apiVersions": { "network": "2018-01-01" }
},
"resources": [
{
"copy": { "name": "asg", "count": "[variables('numberOfASGs')]" },
"type": "Microsoft.Network/applicationSecurityGroups",
"apiVersion": "[variables('apiVersions').network]",
"name": "[asg.name(mul(1, copyIndex('asg', 0)))]",
"location": "[resourceGroup().location]"
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "[variables('apiVersions').network]",
"name": "[variables('nsgName')]",
"location": "[resourceGroup().location]"
},
{
"copy": { "name": "rule", "count": 50 },
"name": "[concat(variables('nsgName'), '/', format('rule--{0:D3}', copyIndex('rule')))]",
"type": "Microsoft.Network/networkSecurityGroups/securityRules",
"apiVersion": "[variables('apiVersions').network]",
"dependsOn": [ "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]", "asg"],
"properties": {
"priority": "[copyIndex('rule', 100)]",
"protocol": "*", "sourcePortRange": "*", "destinationPortRange": "*",
"access": "Allow", "direction": "Inbound",
"sourceApplicationSecurityGroups": [ { "id": "[resourceId('Microsoft.Network/applicationSecurityGroups', asg.name(add(0, mul(2, copyIndex('rule')))))]" } ],
"destinationApplicationSecurityGroups": [ { "id": "[resourceId('Microsoft.Network/applicationSecurityGroups', asg.name(add(1, mul(2, copyIndex('rule')))))]" } ]
}
}
],
"functions": [
{
"namespace": "asg",
"members": {
"name": {
"parameters": [
{ "name": "i", "type": "int" }
],
"output": {
"value": "[concat('asg--', format('{0:D3}', parameters('i')))]",
"type": "string"
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment