Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
381 stars 1.2k forks source link

[resource-graph] automatically paginate results #5856

Open Klaas- opened 1 year ago

Klaas- commented 1 year ago

Related command

az graph query

Extension name (the extension in question)

resource-graph 2.1.0

Description of issue (in as much detail as possible)

By default currently 100 results are passed as results to a query, you can increase this with --first to 1000. I would like an option to just get all results, no matter how many there are or how many pages it needs to paginate in background. Suggestion "--all" as new option.


ghost commented 1 year ago

Thank you for your feedback. This has been routed to the support team for assistance.

yonzhan commented 1 year ago

route to CXP team

navba-MSFT commented 1 year ago

@Klaas- Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.

navba-MSFT commented 1 year ago

@Klaas- Could you please let me know which graph query command are you trying to run ? awaiting your reply.

Klaas- commented 1 year ago

@Klaas- Could you please let me know which graph query command are you trying to run ? awaiting your reply.

az graph query -q "Resources" but this should happen in every query that has enough responses :)

Klaas- commented 1 year ago

Default: 100

$ az graph query -q "Resources" --query '{Count: count,Total_Records: total_records}'
{
  "Count": 100,
  "Total_Records": 28389
}

Can be increased to 1000 via --first

$ az graph query -q "Resources" --first 1000 --query '{Count: count,Total_Records: total_records}'
{
  "Count": 1000,
  "Total_Records": 28389
}

$ az graph query -q "Resources" --first 2000 --query '{Count: count,Total_Records: total_records}'
Value of --first has to be between 1 and 1000.

And my fictitious "--all" parameter would show:

$ az graph query -q "Resources" --all --query '{Count: count,Total_Records: total_records}'
{
  "Count": 28389,
  "Total_Records": 28389
}

The use case is of cause not showing the total count, but I produce a list of resources that I want to iterate over, in this case all my resources.

ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @chiragg4u.

Issue Details
### Related command az graph query ### Extension name (the extension in question) resource-graph 2.1.0 ### Description of issue (in as much detail as possible) By default currently 100 results are passed as results to a query, you can increase this with --first to 1000. I would like an option to just get all results, no matter how many there are or how many pages it needs to paginate in background. Suggestion "--all" as new option. -----
Author: Klaas-
Assignees: -
Labels: `customer-reported`, `Resource Graph`, `Service Attention`, `needs-team-attention`, `feature-request`
Milestone: -
navba-MSFT commented 1 year ago

@Klaas- Thanks for clarifying.

I am adding service team to look into this ask.

@chiragg4u Could you please look into this and provide some pointers ? Thanks in advance.

Ludovic-Emo-Pyl-Tech commented 4 months ago

Hi, Facing the same topic here. Would you have some news on the implementation ? Thanks in advance for any feedback Regards