Error : Editing policy definition 'Enforce Lowercase or Uppercase on Tags and their Values' in 'subscription ABCXXX' failed. A function or parameter in policy assignment '' associated with the policy definition '' could not be validated. Please either fix the policy or remove the policy assignment to unblock. If using template functions, try following the tips in: https://aka.ms/policy-avoiding-template-failures. The inner exception 'Unable to evaluate the template language function 'json'. The argument provided is not a valid JSON string.
"parameters": {
"toLowerOrToUpper": {
"type": "String",
"metadata": {
"displayName": "Enforce Lowercase or Uppercase",
"description": "If set to Lowercase then the Policy will convert all tags on existing and new resources to lowercase. Uppercase will convert them to uppercase."
},
"allowedValues": [
"Lowercase",
"Uppercase"
]
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Resources/subscriptions/resourceGroups"
}
]
},
"then": {
"effect": "modify",
"operations": [
{
"operation": "addOrReplace",
"field": "tags",
"value": "[json(if(equals(parameters('toLowerOrToUpper'), 'Lowercase'), toLower(string(field('tags'))),toUpper(string(field('tags')))))]"
}
]
}
}
}
I'm not sure how to get this entirely working but in the "then" block I think you should have "effect" and "details" which contains "operations" and "roleDefinitionIds".
Here is an example (modify it to suit your needs):
Source: https://learn.microsoft.com/en-us/azure/governance/policy/samples/pattern-effect-details