【发布时间】:2021-08-25 05:59:22
【问题描述】:
我需要添加资源类型作为标签值。有人可以帮我创建这个吗?
到目前为止,我已应用此示例策略。我需要在资源类型中添加标签名称resource_class,它应该从类型中获取它,我可以将名称拆分为值中的类型名称。
{
"mode": "Indexed",
"policyRule": {
"if": {
"anyOf": [
{
"field": "tags[division]",
"exists": "false"
},
{
"field": "tags[division_code]",
"exists": "false"
}
]
},
"then": {
"effect": "append",
"details": [
{
"field": "tags[division]",
"value": "[tolower(parameters('division'))]"
},
{
"field": "tags[division_code]",
"value": "[tolower(parameters('division_code'))]"
}
]
}
},
"parameters": {
"division": {
"type": "String",
"metadata": {
"displayName": "division",
"description": "Value of the tag, such as 'production'"
}
},
"division_code": {
"type": "String",
"metadata": {
"displayName": "division_code",
"description": "Value of the tag, such as '1234'"
}
}
}
}
【问题讨论】:
-
到目前为止你有什么?
-
我已经用政策代码更新了我的问题。
标签: json azure azure-policy