Closed
Description
Description of the new feature
Search-AzGraph
does not support paging in itself. One can specify -First
to 1000, but that's not always enough.
As of today I handle paging myself like this (in case it is useful for others):
# Assets
$QueryResults = [System.Collections.Generic.List[PSCustomObject]]::new()
Remove-Variable -Name 'Response' -Force -ErrorAction 'Ignore'
## Get resource containers with Resource Graph which uses paging
do {
$Splat = [ordered]@{
'Query' = [string] '<insert_query_here>
'UseTenantScope' = [bool] $true
}
if (-not [string]::IsNullOrEmpty($Response.'SkipToken')) {
$Splat.Add('SkipToken', $Response.'SkipToken')
}
$Response = Search-AzGraph @Splat
$QueryResults.AddRange($Response.'Data')
Write-Information -MessageData ('Found {0} so far.' -f $QueryResults.'Count'.ToString())
} until ([string]::IsNullOrEmpty($Response.'SkipToken'))
Proposed implementation details (optional)
Support a -All
switch that handles paging and returns all results.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
[-][Feature]: `Search-AzGraph` should support paging with `-All` switch[/-][+][Feature]: `Search-AzGraph` should support paging with a new `-All` switch[/+]github-actions commentedon May 12, 2025
Here are some similar issues that might help you. Please check if they can solve your problem.
Search-AzGraph
- Parameter to handle pagination / return all items #24163Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)
Thanks for the feedback, I'll loop in Resource Graph team.
The common practice in Azure PowerShell is to handle pagination and return all items by default (
Get-AzResource
for example) unless ifSearch-AzGraph
has its reason.Reference:
Search-AzGraph
- Parameter to handle pagination / return all items #24163 (comment)Powered by issue-sentinel
o-l-a-v commentedon May 12, 2025
I'm apperently not good enough at searching for open issues. Thanks bot!
Search-AzGraph
- Parameter to handle pagination / return all items #24163