Skip to content

Commit

Permalink
Add prefix param to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfholgate committed Jul 9, 2024
1 parent 8f2d393 commit 088245a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions accelerator/scripts/destroy-landing-zone.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

param (
[bool]$whatIfEnabled = $true,
[string]$prefix = $env:PREFIX,
[string]$intermediateRootGroupID = $env:MANAGEMENT_GROUP_ID,
[string]$tenantRootGroupID = $env:ROOT_PARENT_MANAGEMENT_GROUP_ID,
[string]$connectivitySubscriptionId = $env:CONNECTIVITY_SUBSCRIPTION_ID,
Expand Down Expand Up @@ -87,7 +88,7 @@ ForEach ($subscription in $subscriptionsToClean) {

$resourceGroupsToRemove = @()
ForEach ($resourceGroup in $resourceGroups) {
if ($resourceGroup.ResourceGroupName -like "rg-$intermediateRootGroupID-*") {
if ($resourceGroup.ResourceGroupName -like "rg-$prefix*") {
$resourceGroupsToRemove += $resourceGroup.ResourceGroupName
}
}
Expand All @@ -104,7 +105,7 @@ ForEach ($subscription in $subscriptionsToClean) {

$deploymentsToRemove = @()
ForEach ($deployment in $subDeployments) {
if ($deployment.DeploymentName -like "$intermediateRootGroupID-*" -and $deployment.ProvisioningState -eq "Succeeded") {
if ($deployment.DeploymentName -like "$prefix*" -and $deployment.ProvisioningState -eq "Succeeded") {
$deploymentsToRemove += $deployment
}
}
Expand Down

0 comments on commit 088245a

Please sign in to comment.