Skip to content

Commit 15ae4f1

Browse files
committed
fix what if check
1 parent 14dc0ad commit 15ae4f1

3 files changed

Lines changed: 4 additions & 18 deletions

File tree

alz/azuredevops/pipelines/bicep/templates/cd-template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ stages:
139139
azurePowerShellVersion: LatestVersion
140140
ScriptType: "InlineScript"
141141
Inline: |
142-
$intRootMgId = "$(INTERMEDIATE_ROOT_MANAGEMENT_GROUP_ID)"
142+
$intRootMgId = "$(MANAGEMENT_GROUP_ID_PREFIX)$(INTERMEDIATE_ROOT_MANAGEMENT_GROUP_ID)$(MANAGEMENT_GROUP_ID_POSTFIX)"
143143
144144
$managementGroups = Get-AzManagementGroup
145145
$intRootMg = $managementGroups | Where-Object { $_.Name -eq $intRootMgId }

alz/azuredevops/pipelines/bicep/templates/ci-template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ stages:
7878
azurePowerShellVersion: LatestVersion
7979
ScriptType: "InlineScript"
8080
Inline: |
81-
$intRootMgId = "$(INTERMEDIATE_ROOT_MANAGEMENT_GROUP_ID)"
81+
$intRootMgId = "$(MANAGEMENT_GROUP_ID_PREFIX)$(INTERMEDIATE_ROOT_MANAGEMENT_GROUP_ID)$(MANAGEMENT_GROUP_ID_POSTFIX)"
8282
8383
$managementGroups = Get-AzManagementGroup
8484
$intRootMg = $managementGroups | Where-Object { $_.Name -eq $intRootMgId }

alz/github/actions/bicep/templates/actions/bicep-first-deployment-check/action.yaml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,8 @@ runs:
1515
with:
1616
azPSVersion: 'latest'
1717
inlineScript: |
18-
# Read the int-root management group name from the bicepparam file
19-
$intRootParamFile = "templates/core/governance/mgmt-groups/int-root/main.bicepparam"
20-
if (Test-Path $intRootParamFile) {
21-
$paramContent = Get-Content $intRootParamFile -Raw
22-
if ($paramContent -match 'managementGroupName:\s*[''"](\w+)[''"]+') {
23-
$intRootMgId = $matches[1]
24-
Write-Host "Found int-root management group name in param file: $intRootMgId"
25-
} else {
26-
Write-Warning "Could not parse managementGroupName from $intRootParamFile, using default 'alz'"
27-
$intRootMgId = "alz"
28-
}
29-
} else {
30-
Write-Warning "Int-root param file not found at $intRootParamFile, using default 'alz'"
31-
$intRootMgId = "alz"
32-
}
33-
18+
$intRootMgId = $env:MANAGEMENT_GROUP_ID_PREFIX + $env:INTERMEDIATE_ROOT_MANAGEMENT_GROUP_ID + $env:MANAGEMENT_GROUP_ID_POSTFIX
19+
3420
$managementGroups = Get-AzManagementGroup
3521
$intRootMg = $managementGroups | Where-Object { $_.Name -eq $intRootMgId }
3622

0 commit comments

Comments
 (0)