您是否在寻找下面的策略,在这里您可以在参数中传递自动化帐户(资源类型)。您可以找到内置策略列表here。
请关注此link 在 Azure 门户上查看策略定义。
{
"properties": {
"displayName": "Audit diagnostic setting",
"policyType": "BuiltIn",
"mode": "All",
"description": "Audit diagnostic setting for selected resource types",
"metadata": {
"version": "1.0.0",
"category": "Monitoring"
},
"parameters": {
"listOfResourceTypes": {
"type": "Array",
"metadata": {
"displayName": "Resource Types",
"strongType": "resourceTypes"
}
}
},
"policyRule": {
"if": {
"field": "type",
"in": "[parameters('listOfResourceTypes')]"
},
"then": {
"effect": "AuditIfNotExists",
"details": {
"type": "Microsoft.Insights/diagnosticSettings",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Insights/diagnosticSettings/logs.enabled",
"equals": "true"
},
{
"field": "Microsoft.Insights/diagnosticSettings/metrics.enabled",
"equals": "true"
}
]
}
}
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/7f89b1eb-583c-429a-8828-af049802c1d9",
"type": "Microsoft.Authorization/policyDefinitions",
"name": "7f89b1eb-583c-429a-8828-af049802c1d9"
}