Skip to content

Commit

Permalink
Write failedPolicyRemediationTasksJsonString and createWorkItem on Fa…
Browse files Browse the repository at this point in the history
…iled to Create Remediation (#821)

* updated condition for setting ceateWorkItem to true

* remove additional space

* removed duplicate (-not $Interactive) statement
  • Loading branch information
LeonB87 authored Nov 18, 2024
1 parent 2a2db8b commit 11aa107
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Scripts/Operations/New-AzRemediationTasks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,6 @@ else {
Write-Information "$succeeded succeeded"
if ($failed -gt 0) {
Write-Information "$failed failed"
if (-not $Interactive) {
$failedPolicyRemediationTasksJsonString = $failedPolicyRemediationTasks | ConvertTo-Json -Depth 10 -Compress
Write-Output "##vso[task.setvariable variable=failedPolicyRemediationTasksJsonString;isOutput=true]$($failedPolicyRemediationTasksJsonString)"
$createWorkItem = $true
}
}
if ($canceled -gt 0) {
Write-Information "$canceled canceled"
Expand All @@ -397,6 +392,12 @@ else {
Write-Information "$stillRunning still running after $checkForMinutes minutes"
}
if (-not $Interactive) {
if (($failed -gt 0) -or ($failedToCreate -gt 0)) {
$failedPolicyRemediationTasksJsonString = $failedPolicyRemediationTasks | ConvertTo-Json -Depth 10 -Compress
Write-Output "##vso[task.setvariable variable=failedPolicyRemediationTasksJsonString;isOutput=true]$($failedPolicyRemediationTasksJsonString)"
$createWorkItem = $true
}

Write-Output "##vso[task.setvariable variable=createWorkItem;isOutput=true]$($createWorkItem)"
}
}
Expand Down

0 comments on commit 11aa107

Please sign in to comment.