Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit at 100 returned objects? #16527

Closed
ghost opened this issue Oct 9, 2018 · 9 comments
Closed

Limit at 100 returned objects? #16527

ghost opened this issue Oct 9, 2018 · 9 comments

Comments

@ghost
Copy link

ghost commented Oct 9, 2018

Hi,

apparently, I can only return up to 100 results with my queries. I've tried to increase the limit to a very high value but it would still cut the results at 100 returned objects.
$graphQueryResult = Search-AzureRmGraph -Query "where type =~ 'Microsoft.Compute/virtualMachines' | limit 10000"

$graphQueryResult.Count
100

Is this a limitation with the preview? Or is there anything that could be configured?

Thanks


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@DCtheGeek
Copy link
Contributor

DCtheGeek commented Oct 10, 2018

@holgerjay Thanks for trying out Resource Graph and for the question! The Search-AzureRmGraph (and Search-AzGraph) cmdlets have a parameter called First. By default, it is set to 100 if not defined. This is what is limiting your results. You can set the number lower or higher to match your needs. Please let me know if this fixes your issue. Thanks!

p.s. If you just want the number of matching resources and not the resources themselves, you can simplify your query to where type =~ 'Microsoft.Compute/virtualMachines' | summarize count(). Note that if you summarize the count, it's a single record returned, so the First parameter would not need to be increased just to get the total count. Hope this helps!

@MicrosoftDocs/azure-cxp-triage Please assign to me, label as 'product-question', and #in-progress.

@ghost
Copy link
Author

ghost commented Oct 10, 2018

Thank you @DCtheGeek - using the -First parameter works great.
Thanks a lot for the quick response!

@ghost
Copy link
Author

ghost commented Oct 10, 2018

I just saw that this information is also part of the full help. Cool. Last question: Is there a reason that the parameter range goes up to 5000 only?

        [Parameter(
            Mandatory = false,
            HelpMessage = "The maximum number of objects to return. Default value is 100.")]
        [ValidateRange(1, 5000), PSDefaultValue(Value = 100)]

@DCtheGeek
Copy link
Contributor

@holgerjay Resource Graph is in Preview. Limits like this are so they can test the functionality and scalability without negative impact to other services and capabilities. It may or may not change at GA. Not an answer, but the best I can give you today. Thanks again for the questions!

@MicrosoftDocs/azure-cxp-triage #please-close

@mark6628
Copy link

mark6628 commented Apr 1, 2019

Hi, I have started working on Azure Resource Graph and my resource group has resources 1082 but even using first parameter as -First 5000 it is returning 1000 entries only not more then that.

@mark6628
Copy link

mark6628 commented Apr 1, 2019

PS /root> $query = "project name, type, resourceGroup, subscriptionId, tags" PS /root> $Result = Search-AzGraph -Query $query -Subscription 7484ec2d-e33a-478e-b532-1fbcd9980b2e -First 5000
PS /root> $Result.count
1000
PS /root>

@mark6628
Copy link

mark6628 commented Apr 1, 2019

hosting-sws-active-001 7484ec2d-e33a-478e-b532-1fbcd9980b2e
image
Some how azure resource graph is taking hidden types as well.

@DCtheGeek
Copy link
Contributor

@mark6628 Make sure you add the 'id' field to your query output when going over 1000 records, otherwise the autopaging in the CLI/PS won't work.

@rudoletz
Copy link

Windows and Linux Search-AzGraph have a different maximum value for -First parameter. In Windows maximum limit is 5000, but Linux is 1000

Tested with PowerShell 7.1.3 and Az.ResourceGraph 0.9.0 in both environments

In Windows:

$results = Search-AzGraph -Query "where type != ''" -First 5001
Search-AzGraph: Cannot validate argument on parameter 'First'. The 5001 argument is greater than the maximum allowed range of 5000. Supply an argument that is less than or equal to 5000 and then try the command again.

In Linux:

$results = Search-AzGraph -Query "where type !=''" -First 5000
Search-AzGraph: Cannot validate argument on parameter 'First'. The 5000 argument is greater than the maximum allowed range of 1000. Supply an argument that is less than or equal to 1000 and then try the command again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants