Azure REST API to List vaults in the specified resource group ignores $top parameter and always returns 4

Anita Govindarajan 6 Reputation points
2021-11-05T22:15:57.987+00:00

https://learn.microsoft.com/en-us/rest/api/keyvault/vaults/list-by-resource-group

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults?$top={$top}&api-version=2019-09-01

The URI optional parameter $top should set the maximum number of results to return but does not work. It always returns 4 and ignores any value used with $top.
The nextLink parameter appears and recursive queries need to be used to display any list greater than 4.

This does not work with Postman or with C# code and appears to be a bug. Thanks for any help with resolving this issue.

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
Microsoft Partner Center API
{count} vote

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 37,231 Reputation points Microsoft Employee Moderator
    2021-11-08T22:05:51.78+00:00

    @Anita Govindarajan
    Thank you for your time and patience throughout this issue!

    I was able to confirm that the $top parameter isn't working within the Vaults - List By Resource Group REST API. When running the API for myself, it was returning all 3 Key Vaults that I had within my resource group even with the top parameter.

    147500-image.png
    Note: The output was too large to capture my 3rd vault within this screenshot.

    I've reached out to our Key Vault engineering team and will update as soon as possible.

    If you have any other questions, please let me know.
    Thank you for your time and patience throughout this issue.

    ----------

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.