From f5c62e5a7a09f8faca0ed98d1e980f2a8781fc08 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Mon, 15 Dec 2025 09:05:40 +0000 Subject: [PATCH 1/4] fix: bicep folder structure --- .../Public/New-AcceleratorFolderStructure.ps1 | 30 ++++++++----------- src/ALZ/Public/Remove-PlatformLandingZone.ps1 | 9 +++++- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 b/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 index 695bca6..f18f19e 100644 --- a/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 +++ b/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 @@ -96,13 +96,9 @@ function New-AcceleratorFolderStructure { # Clone the repo and copy the bootstrap and starter configuration files $repo = $repos[$iacType] Write-Host "Cloning repo $($repo.repoName)" - git clone -n --depth=1 --filter=tree:0 "https://github.com/Azure/$($repo.repoName)" "$tempFolderPath" | Write-Verbose | Out-Null + git clone --depth=1 "https://github.com/Azure/$($repo.repoName)" "$tempFolderPath" | Write-Verbose | Out-Null Set-Location $tempFolderPath - Write-Host "Checking out folder $($repo.folderToClone)" - git sparse-checkout set --no-cone $repo.folderToClone | Write-Verbose | Out-Null - git checkout | Write-Verbose | Out-Null - Set-Location $currentPath $exampleFolderPath = "$($repo.folderToClone)/$($repo.exampleFolderPath)" $bootstrapExampleFolderPath = "$exampleFolderPath/$($repo.bootstrapExampleFolderPath)" @@ -124,25 +120,25 @@ function New-AcceleratorFolderStructure { # Copy the platform landing zone configuration files based on scenario number or specific file path if ($repo.hasScenarios) { $scenarios = @{ - 1 = "full-multi-region/hub-and-spoke-vnet" - 2 = "full-multi-region/virtual-wan" - 3 = "full-multi-region-nva/hub-and-spoke-vnet" - 4 = "full-multi-region-nva/virtual-wan" - 5 = "management-only/management" - 6 = "full-single-region/hub-and-spoke-vnet" - 7 = "full-single-region/virtual-wan" - 8 = "full-single-region-nva/hub-and-spoke-vnet" - 9 = "full-single-region-nva/virtual-wan" + 1 = "full-multi-region/hub-and-spoke-vnet.tfvars" + 2 = "full-multi-region/virtual-wan.tfvars" + 3 = "full-multi-region-nva/hub-and-spoke-vnet.tfvars" + 4 = "full-multi-region-nva/virtual-wan.tfvars" + 5 = "management-only/management.tfvars" + 6 = "full-single-region/hub-and-spoke-vnet.tfvars" + 7 = "full-single-region/virtual-wan.tfvars" + 8 = "full-single-region-nva/hub-and-spoke-vnet.tfvars" + 9 = "full-single-region-nva/virtual-wan.tfvars" } Write-Host "Copying platform landing zone configuration file for scenario $scenarioNumber to $($targetFolderPath)/config/platform-landing-zone.tfvars" - Copy-Item -Path "$tempFolderPath/templates/platform_landing_zone/examples/$($scenarios[$scenarioNumber]).tfvars" -Destination "$targetFolderPath/config/platform-landing-zone.tfvars" -Force | Write-Verbose | Out-Null + Copy-Item -Path "$tempFolderPath/$exampleFolderPath/$($scenarios[$scenarioNumber])" -Destination "$targetFolderPath/config/platform-landing-zone.tfvars" -Force | Write-Verbose | Out-Null } elseif ($repo.platformLandingZoneFilePath -ne "") { Write-Host "Copying platform landing zone configuration file to $($targetFolderPath)/config/platform-landing-zone.yaml" - Copy-Item -Path "$tempFolderPath/$($repo.platformLandingZoneFilePath)" -Destination "$targetFolderPath/config/platform-landing-zone.yaml" -Force | Write-Verbose | Out-Null + Copy-Item -Path "$tempFolderPath/$exampleFolderPath/$($repo.platformLandingZoneFilePath)" -Destination "$targetFolderPath/config/platform-landing-zone.yaml" -Force | Write-Verbose | Out-Null } - Remove-Item -Path $tempFolderPath -Recurse -Force | Write-Verbose | Out-Null + # Remove-Item -Path $tempFolderPath -Recurse -Force | Write-Verbose | Out-Null } } diff --git a/src/ALZ/Public/Remove-PlatformLandingZone.ps1 b/src/ALZ/Public/Remove-PlatformLandingZone.ps1 index b696468..b1839f7 100644 --- a/src/ALZ/Public/Remove-PlatformLandingZone.ps1 +++ b/src/ALZ/Public/Remove-PlatformLandingZone.ps1 @@ -369,7 +369,7 @@ function Remove-PlatformLandingZone { } function Test-RequiredTooling { - Write-ToConsoleLog "Checking the software requirements for the Accelerator..." + Write-ToConsoleLog "Checking the software requirements..." $checkResults = @() $hasFailure = $false @@ -795,6 +795,13 @@ function Remove-PlatformLandingZone { # For each custom role definition, find and delete all assignments using Resource Graph, then delete the definition foreach ($roleDefinition in $customRoleDefinitions) { + $graphExtension = az extension show --name resource-graph 2>$null + if (-not $graphExtension) { + Write-ToConsoleLog "Installing Azure Resource Graph extension for role assignment queries..." -NoNewLine -IsWarning + az config set extension.dynamic_install_allow_preview=true 2>$null + az extension add --name resource-graph 2>$null + } + Write-ToConsoleLog "Processing custom role definition: $($roleDefinition.roleName) (ID: $($roleDefinition.name))" -NoNewLine # Use Resource Graph to find all role assignments for this custom role definition across all scopes From c289a96a1d1e8787929d9cee7c7a0467a908ff22 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Mon, 15 Dec 2025 09:05:57 +0000 Subject: [PATCH 2/4] Fix typo --- src/ALZ/Public/New-AcceleratorFolderStructure.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 b/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 index f18f19e..08c3a61 100644 --- a/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 +++ b/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 @@ -23,7 +23,7 @@ function New-AcceleratorFolderStructure { [string] $targetFolderPath = "~/accelerator", [Parameter( Mandatory = $false, - HelpMessage = "[OPTIONAL] Forece recreate of the target folder if it already exists" + HelpMessage = "[OPTIONAL] Force recreate of the target folder if it already exists" )] [switch] $force ) From 402fbca952d09c82de58f518ca0141176a305ad5 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Mon, 15 Dec 2025 09:08:57 +0000 Subject: [PATCH 3/4] add warning --- src/ALZ/Public/Remove-PlatformLandingZone.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ALZ/Public/Remove-PlatformLandingZone.ps1 b/src/ALZ/Public/Remove-PlatformLandingZone.ps1 index b1839f7..2b830e0 100644 --- a/src/ALZ/Public/Remove-PlatformLandingZone.ps1 +++ b/src/ALZ/Public/Remove-PlatformLandingZone.ps1 @@ -863,6 +863,8 @@ function Remove-PlatformLandingZone { Test-RequiredTooling + Write-ToConsoleLog "This cmdlet uses preview features of the Azure CLI. By continuing, you agree to install preview extensions." -IsWarning + $TempLogFileForPlan = "" if($PlanMode) { Write-ToConsoleLog "Plan Mode enabled, no changes will be made. All actions will be logged as what would be performed." -IsWarning From 846c85baf5f350f6638d33c4a8c31e45945ecdb4 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Mon, 15 Dec 2025 09:11:36 +0000 Subject: [PATCH 4/4] tidy up --- src/ALZ/Public/New-AcceleratorFolderStructure.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 b/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 index 08c3a61..48af704 100644 --- a/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 +++ b/src/ALZ/Public/New-AcceleratorFolderStructure.ps1 @@ -139,6 +139,6 @@ function New-AcceleratorFolderStructure { Copy-Item -Path "$tempFolderPath/$exampleFolderPath/$($repo.platformLandingZoneFilePath)" -Destination "$targetFolderPath/config/platform-landing-zone.yaml" -Force | Write-Verbose | Out-Null } - # Remove-Item -Path $tempFolderPath -Recurse -Force | Write-Verbose | Out-Null + Remove-Item -Path $tempFolderPath -Recurse -Force | Write-Verbose | Out-Null } }