Every resource including the resource groups are tagged in the ARM template. Tags help with the categorization of resources, and this helps with generating multiple types of reports, by slicing and dicing the logs generated by Azure, to gain insights into them. For example, tags can help in providing costs and usage information based on environments, departments, and other categories if the user provides this information as custom tags to the resources. It is a good design to tag resources and resource groups.
Tags are assigned to resources using the tags element. The tags can be assigned statically, as shown here:
"tags": {
"department": "Finance",
"environment": "Development",
"resourceType" : "resource group"
},
In the current scenario, however, tags are not assigned statically. The values for tags are provided as parameters, as shown in the listing here:
"environmentName": {
"type": "string",
"allowedValues": [ "DEV", "TST", "PRD", "SIT", "PAT", "STG", "UAT" ]
},
"department": {
"type": "string"
},
These parameters are used in variables to generate the tag value:
"variableTags": "[json(concat('{\"application\": \"All\", \"environment\": \"',parameters('environmentName'),'\", \"supportTeam\": \"',parameters('department'),'\"}'))]",
And then the variable “variableTags” is assigned to tags element in in all the resources as shown here.
"tags": "[variables('variableTags')]",