Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefajers authored Apr 24, 2024
1 parent d305b3d commit 6b4590e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/internal/functions/Get-AzOpsResourceDefinition.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,15 @@
}
}
else {
if ($SubscriptionsToIncludeResourceGroups -ne '*') {
$subscriptionsToIncludeResourceGroups = $subscriptions | Where-Object { $_.Id -in $SubscriptionsToIncludeResourceGroups }
}
$query = "resourcecontainers | where type == 'microsoft.resources/subscriptions/resourcegroups' | where managedBy == '' | order by ['id'] asc"
if ($subscriptionsToIncludeResourceGroups) {
$resourceGroups = Search-AzOpsAzGraph -Subscription $subscriptionsToIncludeResourceGroups -Query $query -ErrorAction Stop
if ($SubscriptionsToIncludeResourceGroups -ne '*') {
$newSubscriptionsToIncludeResourceGroups = $subscriptions | Where-Object { $_.Id -in $SubscriptionsToIncludeResourceGroups }
if ($newSubscriptionsToIncludeResourceGroups) {
$resourceGroups = Search-AzOpsAzGraph -Subscription $newSubscriptionsToIncludeResourceGroups -Query $query -ErrorAction Stop
}
else {
Write-AzOpsMessage -LogLevel Debug -LogString 'Get-AzOpsResourceDefinition.Subscription.NotFound' -Target $ScopeObject
}
}
else {
$resourceGroups = Search-AzOpsAzGraph -Subscription $subscriptions -Query $query -ErrorAction Stop
Expand Down

0 comments on commit 6b4590e

Please sign in to comment.