Write Azure policy to deny adding a second diagnostic setting to any resource if the first diagnostic setting already exists

jarvis-8094 0 Reputation points
2023-11-06T04:17:46.31+00:00

I tried the below code, but it doesn't seem to have any resource details and it doesn't work

{ "mode": "All", "policyRule": { "if": { "field": "type", "equals": "Microsoft.Insights/diagnosticSettings" }, "then": { "effect": "deny" } }, "parameters": {} }

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,489 questions
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
714 questions
{count} votes