Skip to content

Commit

Permalink
Merge pull request #93 from Azure/92-child-mg-does-not-contain-a-scop…
Browse files Browse the repository at this point in the history
…e-property-when-evaluating-globalnotscope-on-assignmentsplan

Fix $child.scope bug
  • Loading branch information
techlake authored Nov 10, 2022
2 parents ff686cc + 9c932df commit 8cb5246
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Scripts/Helpers/Get-NotScope.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ function Get-NotScope {
$notScope += "$($child.id)"
# Write-Host "##[debug] notScope added $($child.Id)"
}
elseif ($child.scope.StartsWith("/providers/Microsoft.Management/managementGroups/")) {
elseif ($child.id.StartsWith("/providers/Microsoft.Management/managementGroups/")) {
$null = $queuedManagementGroups.Enqueue($child)
# Write-Host "##[debug] enqueue child $($child.Id)"
}
elseif ($child.scope.StartsWith("/subscriptions/")) {
elseif ($child.id.StartsWith("/subscriptions/")) {
# Write-Host "##[debug] subscription testing list += subscription $($child.Id)"
$subscriptionIds += $child.id
}
Expand All @@ -72,11 +72,11 @@ function Get-NotScope {
else {
if ($null -ne $currentMg.children) {
foreach ($child in $currentMg.children) {
if ($child.scope.StartsWith("/providers/Microsoft.Management/managementGroups/")) {
if ($child.id.StartsWith("/providers/Microsoft.Management/managementGroups/")) {
$null = $queuedManagementGroups.Enqueue($child)
# Write-Host "##[command] finding root enqueue child $($child.Id)"
}
elseif (!$child.scope.StartsWith("/subscriptions/")) {
elseif (!$child.id.StartsWith("/subscriptions/")) {
Write-Error "Traversal of scopeTree to find scope '$scope' yielded an unknown type '$($child.type)' name='$($child.name)'" -ErrorAction Stop
}
}
Expand Down

0 comments on commit 8cb5246

Please sign in to comment.