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

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