Created
March 6, 2020 15:39
-
-
Save Nomenator/2a269044175385f0bb383e5cc66f6a57 to your computer and use it in GitHub Desktop.
Deploy multiple resource grops in Azure
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/2018-05-01/subscriptionDeploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"rgNames": { | |
"type": "array" | |
}, | |
"rgLocation": { | |
"type": "string" | |
} | |
}, | |
"variables": {}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Resources/resourceGroups", | |
"apiVersion": "2018-05-01", | |
"location": "[parameters('rgLocation')]", | |
"name": "[parameters('rgNames')[copyIndex()]]", | |
"copy": { | |
"name": "rgCopy", | |
"count": "[length(parameters('rgNames'))]" | |
} | |
} | |
] | |
} |
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/2015-01-01/deploymentParameters.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"rgNames": { | |
"value": [ | |
"group1", | |
"group2", | |
"group3", | |
"group4" | |
] | |
}, | |
"rgLocation": { | |
"value": "eastus" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On a side note, it's curious that the template file is still being read with the
-TemplateUri
command, as shown by the proper expectation ofrgNames
parameter value, but the parameter file is not being read with the-TemplateParameterUri
, parameter.