Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions alz/local/scripts-bicep/bicep-first-deployment-check.ps1

This file was deleted.

3 changes: 1 addition & 2 deletions alz/local/scripts/bicep-deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
26 changes: 5 additions & 21 deletions alz/local/scripts/bicep-first-deployment-check.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion alz/local/scripts/bicep-on-demand-folder.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
3 changes: 1 addition & 2 deletions alz/local/scripts/deploy-local.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,4 @@ if($deployApproved -ne "yes") {
-firstRunWhatIf ${script_file.firstRunWhatIf} `
-firstDeployment $isFirstDeployment `

if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
%{ endfor ~}
%{ endfor ~}
Loading