Azure / enterprise-azure-policy-as-code

Enterprise-ready Azure Policy-as-Code (PaC) solution (includes Az DevOps pipeline)
https://azure.github.io/enterprise-azure-policy-as-code/
MIT License
410 stars 216 forks source link

Policy definitions no longer found when assigning exemptions #611

Closed arrerezai closed 4 months ago

arrerezai commented 4 months ago

Describe the bug Moving to Epac v10.2.2 introduces a new issue with policy exemptions. While the json files previously created work well with older Epac v10+ versions, this is no longer the case with v10.2.2.

To Reproduce all-exemptions.jsonc: { "$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-exemption-schema.json", "exemptions": [ { "name": "<guid>", "displayName": "<name>", "description": "<description>", "exemptionCategory": "<category>", "expiresOn": "", "scopes": [ "<scope>" ], "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/0b60c0b2-2dc2-4e1c-b5c9-abbed971de53" }, { "name": "<guid>", "displayName": "<name>", "description": "<description>", "exemptionCategory": "<category>", "expiresOn": "", "scopes": [ "<scope>" ], "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1e66c121-a66a-4b1f-9b83-0fd99bf0fc2d" } ] }

Expected behavior Assign exemptions if not present, keep them if previously assigned. Confirmed that the policy does exist and on the appropriate scope, so the code shouldn't be throwing out a warning message, skipping the row. Nor should it delete the already assigned exemptions as can be seen in the screenshot below.

Screenshots image

EPAC Version Epac v10.2.2.

techlake commented 4 months ago

I'll fix this shortly