Azure-docs: Limit at 100 returned objects?

Created on 10 Oct 2018  Â·  8Comments  Â·  Source: MicrosoftDocs/azure-docs

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.

assigned-to-author in-progress product-question resource-grapsvc triaged

Most helpful comment

@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.

All 8 comments

@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.

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

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)]

@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

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.

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>

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

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JamesDLD picture JamesDLD  Â·  3Comments

AronT-TLV picture AronT-TLV  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments

jamesgallagher-ie picture jamesgallagher-ie  Â·  3Comments

monteledwards picture monteledwards  Â·  3Comments