Skip to content

Commit

Permalink
change error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelle Broekhuijsen committed Sep 4, 2023
1 parent 94644f1 commit 2cb2001
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Remove-AzManagementGroups.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.PARAMETER TenantId
The tenant id to run the script against
.NOTES
Version: 1.1.1
Version: 1.1.2
Author: Jelle Broekhuijsen - jll.io Consultancy
Creation Date: 8/8/2023
Expand Down Expand Up @@ -64,8 +64,7 @@ do {
Write-Output "Attempting to remove management group: $($managementGroup.Name)"
$result = Remove-AzManagementGroup -GroupName $managementGroup.Name -ErrorAction Continue
if ($result -ne $true) {
Write-Warning "Failed to remove management group: $($managementGroup.Name)"
$localFailures.Add($result)
Write-Warning "'Remove-AzManagementGroup -GroupId $($managementGroup.Name)' did not return 'true', this will result in the script retrying the removal of this management group"
}
}
else {
Expand Down

0 comments on commit 2cb2001

Please sign in to comment.