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
435 stars 243 forks source link

Write failedPolicyRemediationTasksJsonString and createWorkItem on Failed to Create Remediation #821

Closed LeonB87 closed 1 week ago

LeonB87 commented 2 weeks ago

I ran into a situation where the number of $failed remediation tasks was 0. But the $failedToCreate was > 0. WIth the current script, the property createWorkItem will not be set to True and the failedPolicyRemediationTasksJsonString property remains empty.

Since the tasks that are "failed to be created" are already being added to the $failedPolicyRemediationTasks, this fix allows for that information to be processed properly.

I modified as little as possible in the existing script to gain functionality.