Skip to content

Commit

Permalink
Fix "Append" Policy generating a null error issue (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
techlake authored Jan 25, 2024
1 parent 1ac259d commit 6fdee01
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Scripts/Helpers/Build-PolicyPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,14 @@ function Build-PolicyPlan {
}

# Calculate roleDefinitionIds for this Policy
if ($definitionProperties.policyRule.then.details -and $definitionProperties.policyRule.then.details.roleDefinitionIds) {
$roleDefinitionIdsInPolicy = $definitionProperties.policyRule.then.details.roleDefinitionIds
$null = $PolicyRoleIds.Add($id, $roleDefinitionIdsInPolicy)
if ($null -ne $definitionProperties.policyRule.then.details) {
$details = $definitionProperties.policyRule.then.details
if ($details -isnot [array]) {
$roleDefinitionIdsInPolicy = $details.roleDefinitionIds
if ($null -ne $roleDefinitionIdsInPolicy) {
$null = $PolicyRoleIds.Add($id, $roleDefinitionIdsInPolicy)
}
}
}

# Constructing Policy parameters for splatting
Expand Down

0 comments on commit 6fdee01

Please sign in to comment.