diff --git a/alz/local/scripts-bicep/bicep-first-deployment-check.ps1 b/alz/local/scripts-bicep/bicep-first-deployment-check.ps1 deleted file mode 100644 index bd0c63cb..00000000 --- a/alz/local/scripts-bicep/bicep-first-deployment-check.ps1 +++ /dev/null @@ -1,33 +0,0 @@ -param( - [string]$managementGroupId -) - -# Read the int-root management group name from the bicepparam file -$intRootParamFile = "templates/core/governance/mgmt-groups/int-root/main.bicepparam" -if (Test-Path $intRootParamFile) { - $paramContent = Get-Content $intRootParamFile -Raw - if ($paramContent -match 'managementGroupName:\s*[''"](\w+)[''"]+') { - $intRootMgId = $matches[1] - Write-Host "Found int-root management group name in param file: $intRootMgId" - } else { - Write-Warning "Could not parse managementGroupName from $intRootParamFile, using default 'alz'" - $intRootMgId = "alz" - } -} else { - Write-Warning "Int-root param file not found at $intRootParamFile, using default 'alz'" - $intRootMgId = "alz" -} - -$managementGroups = Get-AzManagementGroup -$intRootMg = $managementGroups | Where-Object { $_.Name -eq $intRootMgId } - -$firstDeployment = $true - -if ($null -eq $intRootMg) { - Write-Warning "Cannot find the $intRootMgId Management Group, so assuming this is the first deployment. We must skip checking some deployments since their dependent resources do not exist yet." -} else { - Write-Host "Found the $intRootMg Management Group, so assuming this is not the first deployment." - $firstDeployment = $false -} - -return $firstDeployment diff --git a/alz/local/scripts/bicep-deploy.ps1 b/alz/local/scripts/bicep-deploy.ps1 index df3fe578..635f5c5e 100644 --- a/alz/local/scripts/bicep-deploy.ps1 +++ b/alz/local/scripts/bicep-deploy.ps1 @@ -139,10 +139,9 @@ while ($retryCount -lt $retryMax) { if($finalSuccess -eq $false) { Write-Error "Deployment failed after $retryMax attempts..." - exit 1 } Write-Host "<---------------------------------------------------------------------------->" -ForegroundColor DarkMagenta Write-Host "Completed $($whatIf ? "What If" : "Full") $displayName..." -ForegroundColor DarkMagenta Write-Host "<---------------------------------------------------------------------------->" -ForegroundColor DarkMagenta -Write-Host "" +Write-Host "" \ No newline at end of file diff --git a/alz/local/scripts/bicep-first-deployment-check.ps1 b/alz/local/scripts/bicep-first-deployment-check.ps1 index ae33a0dd..eb5305f4 100644 --- a/alz/local/scripts/bicep-first-deployment-check.ps1 +++ b/alz/local/scripts/bicep-first-deployment-check.ps1 @@ -2,32 +2,16 @@ param( [string]$managementGroupId ) -# Read the int-root management group name from the bicepparam file -$intRootParamFile = "templates/core/governance/mgmt-groups/int-root/main.bicepparam" -if (Test-Path $intRootParamFile) { - $paramContent = Get-Content $intRootParamFile -Raw - if ($paramContent -match 'managementGroupName:\s*[''"](\w+)[''"]+') { - $intRootMgId = $matches[1] - Write-Host "Found int-root management group name in param file: $intRootMgId" - } else { - Write-Warning "Could not parse managementGroupName from $intRootParamFile, using default 'alz'" - $intRootMgId = "alz" - } -} else { - Write-Warning "Int-root param file not found at $intRootParamFile, using default 'alz'" - $intRootMgId = "alz" -} - $managementGroups = Get-AzManagementGroup -$intRootMg = $managementGroups | Where-Object { $_.Name -eq $intRootMgId } +$managementGroup = $managementGroups | Where-Object { $_.Name -eq $managementGroupId } $firstDeployment = $true -if ($null -eq $intRootMg) { - Write-Warning "Cannot find the $intRootMgId Management Group, so assuming this is the first deployment. We must skip checking some deployments since their dependent resources do not exist yet." +if($null -eq $managementGroup) { + Write-Warning "Cannot find the $managementGroupId Management Group, so assuming this is the first deployment. We must skip checking some deployments since their dependent resources do not exist yet." } else { - Write-Host "Found the $intRootMgId Management Group, so assuming this is not the first deployment." + Write-Host "Found the $managementGroupId Management Group, so assuming this is not the first deployment." $firstDeployment = $false } -return $firstDeployment +return $firstDeployment \ No newline at end of file diff --git a/alz/local/scripts/bicep-on-demand-folder.ps1 b/alz/local/scripts/bicep-on-demand-folder.ps1 index c1057a25..dc403f20 100644 --- a/alz/local/scripts/bicep-on-demand-folder.ps1 +++ b/alz/local/scripts/bicep-on-demand-folder.ps1 @@ -62,4 +62,4 @@ New-Item -ItemType Directory -Path $targetFolderPath | Out-String | Write-Verbos Copy-Item -Path $sourceFolderPath -Destination $targetFolderPath -Recurse -Force | Out-String | Write-Verbose Remove-Item -Path $tempFolder -Force -Recurse -Write-Host "Successfully copied the files from the release artifact to the target path $targetPath..." +Write-Host "Successfully copied the files from the release artifact to the target path $targetPath..." \ No newline at end of file diff --git a/alz/local/scripts/deploy-local.ps1 b/alz/local/scripts/deploy-local.ps1 index eee5619c..c8aed019 100644 --- a/alz/local/scripts/deploy-local.ps1 +++ b/alz/local/scripts/deploy-local.ps1 @@ -60,5 +60,4 @@ if($deployApproved -ne "yes") { -firstRunWhatIf ${script_file.firstRunWhatIf} ` -firstDeployment $isFirstDeployment ` -if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } -%{ endfor ~} +%{ endfor ~} \ No newline at end of file