Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sinbai this query above is filtering for the resource type and exact name, with a maximum of 5 results - since this is an exact match there should only ever be a single result (or no results) returned - removing the value for the
top
parameter will instead return (I believe) 50-100 results by default.As such I'm a little confused as to how this change will change things, given we're expecting a single result here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, the behavior of the Resource API is different with or without the top parameter. The resource API that uses top+filter first top x from all the resources and then filter them in the top x resources, it will return {"value":[],"nextLink":"xxxxx"} if it does not exist in the first top x. The number of request depends on quantity of resources and the location of the retrieved resource. if there is no top parameter, it will return the value(or no results) directly, and only one request is required. Try the following link may be the proof of above:
https://docs.microsoft.com/en-us/rest/api/resources/resources/list#code-try-0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree with a @sinbai
query with a $top returns {{"value": []}, "nextLink": "url"}
query without $top returns {"value": "url" },
I will open a ticket to Azure, but I want to know why it's used.
We put a strict name of Azure Key Vault in the query
There is no chance to create multiple resources with the same name under the same subscription
This comment was marked as off-topic.
Sorry, something went wrong.