Partager via


ComputeExtensions.GetVirtualMachines Method

Definition

Overloads

GetVirtualMachines(ResourceGroupResource)

Gets a collection of VirtualMachineResources in the ResourceGroupResource. MockingTo mock this method, please mock GetVirtualMachines() instead.

GetVirtualMachines(SubscriptionResource, String, String, Nullable<ExpandTypesForListVm>, CancellationToken)

Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

  • Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines
  • Operation Id: VirtualMachines_ListAll
  • Default Api Version: 2024-07-01
  • Resource: VirtualMachineResource

GetVirtualMachines(ResourceGroupResource)

Source:
ComputeExtensions.cs
Source:
ComputeExtensions.cs

Gets a collection of VirtualMachineResources in the ResourceGroupResource. MockingTo mock this method, please mock GetVirtualMachines() instead.

public static Azure.ResourceManager.Compute.VirtualMachineCollection GetVirtualMachines (this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource);
static member GetVirtualMachines : Azure.ResourceManager.Resources.ResourceGroupResource -> Azure.ResourceManager.Compute.VirtualMachineCollection
<Extension()>
Public Function GetVirtualMachines (resourceGroupResource As ResourceGroupResource) As VirtualMachineCollection

Parameters

resourceGroupResource
ResourceGroupResource

The ResourceGroupResource instance the method will execute against.

Returns

An object representing collection of VirtualMachineResources and their operations over a VirtualMachineResource.

Exceptions

resourceGroupResource is null.

Applies to

GetVirtualMachines(SubscriptionResource, String, String, Nullable<ExpandTypesForListVm>, CancellationToken)

Source:
ComputeExtensions.cs
Source:
ComputeExtensions.cs

Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

  • Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines
  • Operation Id: VirtualMachines_ListAll
  • Default Api Version: 2024-07-01
  • Resource: VirtualMachineResource
public static Azure.Pageable<Azure.ResourceManager.Compute.VirtualMachineResource> GetVirtualMachines (this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string statusOnly = default, string filter = default, Azure.ResourceManager.Compute.Models.ExpandTypesForListVm? expand = default, System.Threading.CancellationToken cancellationToken = default);
static member GetVirtualMachines : Azure.ResourceManager.Resources.SubscriptionResource * string * string * Nullable<Azure.ResourceManager.Compute.Models.ExpandTypesForListVm> * System.Threading.CancellationToken -> Azure.Pageable<Azure.ResourceManager.Compute.VirtualMachineResource>
<Extension()>
Public Function GetVirtualMachines (subscriptionResource As SubscriptionResource, Optional statusOnly As String = Nothing, Optional filter As String = Nothing, Optional expand As Nullable(Of ExpandTypesForListVm) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Pageable(Of VirtualMachineResource)

Parameters

subscriptionResource
SubscriptionResource

The SubscriptionResource instance the method will execute against.

statusOnly
String

statusOnly=true enables fetching run time status of all Virtual Machines in the subscription.

filter
String

The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'.

expand
Nullable<ExpandTypesForListVm>

The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this can only be specified if a valid $filter option is specified.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

A collection of VirtualMachineResource that may take multiple service requests to iterate over.

Exceptions

subscriptionResource is null.

Applies to