Skip to content

Commit

Permalink
Test inherited scope fix (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
anwather authored Oct 18, 2023
1 parent 8a29136 commit c17bbdc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Scripts/Helpers/Get-AzPolicyResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function Get-AzPolicyResources {
Default {
# Read only definitions scopes
$null = $deployedPolicyTable.all.Add($id, $policyResource)
$null = $policyDefinitions.readOnly.Add($id, $policyResource)
$null = $deployedPolicyTable.readOnly.Add($id, $policyResource)
$deployedPolicyTable.counters.inherited += 1
$found = $true
}
Expand Down
24 changes: 24 additions & 0 deletions Scripts/Helpers/Get-AzScopeTree.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,29 @@ function Get-AzScopeTree {
}
Write-Information " Resource groups = $($numberOfResourceGroups)"

if ($PacEnvironment.policyDefinitionsScopes.Count -gt 2) {
# Process policy definitions scopes
$numberOfPolicyDefinitionsScopes = 0
foreach ($policyDefinitionsScope in $PacEnvironment.policyDefinitionsScopes) {
if ($scopeTable.ContainsKey($policyDefinitionsScope) -or $policyDefinitionsScope -eq "") {}
else {
$scopeInformation = @{
id = $policyDefinitionsScope
type = "microsoft.management/managementgroups"
name = $policyDefinitionsScope
displayName = $policyDefinitionsScope
parentList = @{}
childrenList = @{}
resourceGroups = @{}
state = $null
location = "global"
}
$null = $scopeTable.Add($policyDefinitionsScope, $scopeInformation)
$numberOfPolicyDefinitionsScopes++
}
}
Write-Information " Policy definitions scopes = $($numberOfPolicyDefinitionsScopes)"
}

return $scopeTable
}

0 comments on commit c17bbdc

Please sign in to comment.