From 951bed79894825efedc9a8eba31821ebe135840b Mon Sep 17 00:00:00 2001 From: Brunoga-MS Date: Wed, 27 Nov 2024 14:54:28 +0100 Subject: [PATCH] Fixed issue with the removal deployments --- patterns/alz/scripts/Start-AMBA-ALZ-Maintenance.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patterns/alz/scripts/Start-AMBA-ALZ-Maintenance.ps1 b/patterns/alz/scripts/Start-AMBA-ALZ-Maintenance.ps1 index 3e2424a27..b2ad11634 100644 --- a/patterns/alz/scripts/Start-AMBA-ALZ-Maintenance.ps1 +++ b/patterns/alz/scripts/Start-AMBA-ALZ-Maintenance.ps1 @@ -267,7 +267,7 @@ Function Get-ALZ-Deployments { # get deployments to delete $allDeployments = @() ForEach ($mg in $managementGroups) { - $deployments = Get-AzManagementGroupDeployment -ManagementGroupId "$mg" -WarningAction silentlyContinue | where { $_.DeploymentName.StartsWith("amba-") } + $deployments = Get-AzManagementGroupDeployment -ManagementGroupId "$($mg.mgName)" -WarningAction silentlyContinue | where { $_.DeploymentName.StartsWith("amba-") } $allDeployments += $deployments } Write-Host "- Found '$($allDeployments.Count)' deployments for AMBA-ALZ pattern with name starting with 'amba-' performed on the '$pseudoRootManagementGroup' Management Group hierarchy." -ForegroundColor Cyan