Forum Discussion
Resource Group Creation
Hi Stephan,
Can you please help me to create Multiple RG with TAG's for each RG.
The script i am trying is given below but it is throwing error.
Ultimate aim is to create Multiple RG's with TAG's
Template File i am using is :
{
"contentVersion": "1.0.0.0",
"parameters": {
"rgName": {
"type": "array"
},
"tags": {
"type": "object",
"defaultValue": {}
}
},
"variables": {},
"resources": [
{
"copy": {
"name": "RGLoop",
"count": "[length(parameters('rgName'))]"
},
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2019-10-01",
"name": "[parameters('rgName')[copyIndex('RGLoop')].Name]",
"location": "eastus",
"tags": "[parameters('tags')[copyIndex('RGLoop')].tags]",
"properties": {}
}
],
"outputs": {}
}
==============================
Paramater is given below:
{
"contentVersion": "1.0.0.0",
"parameters": {
"rgname": {
"value": [
{
"name": "TestRG"
}
]
},
"tags": {
"value": [
{
"Environment": "Test",
"Team": "skg",
"Application": "SKG",
"Business Unit": "non-production",
"POC": "Vignesh",
"ManagedBy": "Own"
}
]
}
}
}
=========================================
Error I am Getting is:
1 Reply
- michaelelleby123Copper Contributor
vigneshkrcegmailcomThe line "tags": "[parameters('tags')[copyIndex('RGLoop')].tags]", is wrong. It should be:
"tags": "[parameters('tags')[copyIndex('RGLoop')]]",