Azure / Azure/AKS

[Feature] Support `enforcementAction: warn` in Azure Policy for Kubernetes (OPA Gatekeeper)

Open
#5,745 14 comments 0 reactions 1 assignee Claimed by @kevinhwang-microsoft View on GitHub
azure/policy feature-request
Dominant language
TypeScript
Stars
2.1k
Forks
395
Avg merge
2d 22h
Merged PRs (30d)
13

Description

### Summary
Azure Policy for Kubernetes currently does not support the Gatekeeper `enforcementAction: warn` mode. This creates a gap in policy rollout and developer experience, as there is no way to provide non-blocking, real-time feedback at admission time.

---

### Problem Statement
Azure Policy for Kubernetes exposes limited enforcement behaviors:

- `effect: Deny` → maps to `enforcementAction: deny`
- `effect: Audit` → maps to `enforcementAction: dryrun`

However:
- There is **no equivalent for `enforcementAction: warn`**
- Developers do not receive **admission-time feedback** for policy violations unless enforcement is fully set to `Deny`

Even when manually setting:
```yaml
spec:
enforcementAction: warn
```

#### Impact
This limitation affects policy adoption and usability:
- No ability to provide immediate feedback to users during kubectl apply
- Violations are only visible through:
- Constraint status
- Azure Policy compliance dashboards
- No intermediate stage between:
- Silent audit (dryrun)
- Hard enforcement (deny)
- Increased risk when transitioning policies to enforcement due to lack of user awareness

#### Business Justification
- Aligns Azure Policy capabilities with native Gatekeeper features
- Improves developer experience with real-time feedback
- Enables safer and more controlled policy adoption
- Reduces operational risk when transitioning to enforcement

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.