Skip to content

Fix Get-AzureRmVM paging with ResourceGroupName #7292

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

Closed
wants to merge 1 commit into from

Conversation

jabbera
Copy link
Contributor

@jabbera jabbera commented Sep 19, 2018

Add paging support to Get-AzureRmVM when -ResourceGroupName parameter is set.

Description

Get-AzureRmVM -ResourceGroupName blah is only returning 50 results even if there are more then 50 vms in an RG.

You may not believe me, but this test: https://github.com/Azure/azure-powershell/blob/preview/tools/InstallationTests/NetcoreTests/Compute/VirtualMachineTests.ps1#L1988 is currently failing because the paging code does not exist when filtering by resource group name. I have no idea why it used to work unless more the 50 results used to be returned by the endpoint for this call.

Checklist

@cormacpayne
Copy link
Member

@hyonholee Hey Hyonho, would you mind reviewing this PR when you get the chance?

@jabbera jabbera force-pushed the fix-vm-paging-by-rg branch from b768376 to a0a11d6 Compare September 19, 2018 17:55
@jabbera
Copy link
Contributor Author

jabbera commented Sep 19, 2018

Sorted the CI build.

@changov
Copy link
Contributor

changov commented Sep 21, 2018

Sorry, folks, this appears to be a regression from the server side. We just enabled paging for the GET VMs in Resource Group query but it was not done properly with an api-version check. We'll correct this in the next few days. The client-side fix will probably also be needed, but deferring to Hyonho & co. to figure out exactly what & where.


if (!string.IsNullOrEmpty(vmListResult.Body.NextPageLink))
{
vmListResult = this.VirtualMachineClient.ListAllNextWithHttpMessagesAsync(vmListResult.Body.NextPageLink)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use "ListNextWithHttpMessagesAsync"

@hyonholee
Copy link
Contributor

Please hold this PR. I think we need to use the updated the client library which will use 2018-10-01 version. (the client library for 2018-10-01 is not yet published)

Add paging support to Get-AzureRmVM when -ResourceGroupName parameter is set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants