Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "e7b1c2a9-4f3e-4c2a-9b2d-1a2b3c4d5e6f",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Inherit Tag From Subscription To Resource Group",
"description": "Adds the specified tag with its value from the containing subscription when a resource group is missing this tag. Existing resource groups can be remediated by triggering a remediation task. If the tag exists with a different value it will not be changed.",
"metadata": {
"version": "1.0.0",
"category": "Tags"
},
"mode": "All",
"parameters": {
"tagName": {
"type": "String",
"metadata": {
"displayName": "tagName",
"description": "Name of the tag that should be inherited from the subscription, such as 'environment'"
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Modify, Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Modify",
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Modify"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Resources/subscriptions/resourceGroups"
},
{
"field": "[concat('tags[', parameters('tagName'), ']')]",
"exists": "false"
},
{
"value": "[subscription().tags[parameters('tagName')]]",
"notEquals": ""
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
],
"operations": [
{
"operation": "add",
"field": "[concat('tags[', parameters('tagName'), ']')]",
"value": "[subscription().tags[parameters('tagName')]]"
}
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"tagName": {
"type": "String",
"metadata": {
"displayName": "tagName",
"description": "Name of the tag that should be inherited from the subscription, such as 'environment'"
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Modify, Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Modify",
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Modify"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Resources/subscriptions/resourceGroups"
},
{
"field": "[concat('tags[', parameters('tagName'), ']')]",
"exists": "false"
},
{
"value": "[subscription().tags[parameters('tagName')]]",
"notEquals": ""
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
],
"operations": [
{
"operation": "add",
"field": "[concat('tags[', parameters('tagName'), ']')]",
"value": "[subscription().tags[parameters('tagName')]]"
}
]
}
}
}