Share via


Virtual Machines - List By Subscription

List virtual machines in the subscription.
Get a list of virtual machines in the provided subscription.

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines?api-version=2024-07-01

URI Parameters

Name In Required Type Description
subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Responses

Name Type Description
200 OK

VirtualMachineList

The resource list has been successfully retrieved.

Other Status Codes

ErrorResponse

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

List virtual machines for subscription

Sample request

GET https://management.azure.com/subscriptions/123e4567-e89b-12d3-a456-426655440000/providers/Microsoft.NetworkCloud/virtualMachines?api-version=2024-07-01

Sample response

{
  "value": [
    {
      "id": "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/virtualMachines/virtualMachineName",
      "name": "virtualMachineName",
      "systemData": {
        "createdAt": "2021-01-22T13:27:03.008Z",
        "createdBy": "identityA",
        "createdByType": "Application",
        "lastModifiedAt": "2021-01-22T13:29:03.001Z",
        "lastModifiedBy": "identityB",
        "lastModifiedByType": "User"
      },
      "type": "Microsoft.NetworkCloud/virtualMachines",
      "location": "location",
      "tags": {
        "key1": "myvalue1",
        "key2": "myvalue2"
      },
      "extendedLocation": {
        "type": "CustomLocation",
        "name": "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName"
      },
      "properties": {
        "vmImage": "myacr.azurecr.io/foobar:latest",
        "vmImageRepositoryCredentials": {
          "username": "myuser",
          "registryUrl": "myacr.azurecr.io"
        },
        "vmDeviceModel": "T2",
        "cpuCores": 2,
        "memorySizeGB": 8,
        "storageProfile": {
          "osDisk": {
            "createOption": "Ephemeral",
            "deleteOption": "Delete",
            "diskSizeGB": 120
          },
          "volumeAttachments": [
            "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName"
          ]
        },
        "cloudServicesNetworkAttachment": {
          "attachedNetworkId": "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloudServicesNetworkName",
          "ipAllocationMethod": "Dynamic"
        },
        "networkAttachments": [
          {
            "networkAttachmentName": "netAttachName01",
            "attachedNetworkId": "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/l3Networks/l3NetworkName",
            "ipAllocationMethod": "Dynamic",
            "ipv4Address": "198.51.100.1",
            "ipv6Address": "2001:0db8:0000:0000:0000:0000:0000:0000",
            "macAddress": "bf:1c:29:31:31:1f",
            "defaultGateway": "True"
          }
        ],
        "placementHints": [
          {
            "hintType": "Affinity",
            "schedulingExecution": "Hard",
            "resourceId": "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/racks/rackName",
            "scope": ""
          }
        ],
        "userData": "dXNlckRhdGVTYW1wbGU=",
        "networkData": "bmV0d29ya0RhdGVTYW1wbGU=",
        "bootMethod": "UEFI",
        "adminUsername": "username",
        "sshPublicKeys": [
          {
            "keyData": "ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"
          }
        ],
        "provisioningState": "Succeeded",
        "availabilityZone": "1",
        "clusterId": "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/clusters/clusterName",
        "powerState": "On",
        "bareMetalMachineId": "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/bareMetalMachines/bareMetalMachineName",
        "detailedStatus": "Available",
        "detailedStatusMessage": "VM is up and healthy",
        "volumes": [
          "/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName"
        ]
      }
    }
  ],
  "nextLink": "https://fully.qualified.hyperlink"
}

Definitions

Name Description
createdByType

The type of identity that created the resource.

DefaultGateway

The indicator of whether this is the default gateway. Only one of the attached networks (including the CloudServicesNetwork attachment) for a single machine may be specified as True.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

ExtendedLocation

ExtendedLocation represents the Azure custom location where the resource will be created.

ImageRepositoryCredentials

ImageRepositoryCredentials represents the credentials used to login to the image repository.

NetworkAttachment

NetworkAttachment represents the single network attachment.

OsDisk

OsDisk represents configuration of the boot disk.

OsDiskCreateOption

The strategy for creating the OS disk.

OsDiskDeleteOption

The strategy for deleting the OS disk.

SshPublicKey

SshPublicKey represents the public key used to authenticate with a resource through SSH.

StorageProfile

StorageProfile represents information about a disk.

systemData

Metadata pertaining to creation and last modification of the resource.

VirtualMachine

VirtualMachine represents the on-premises Network Cloud virtual machine.

VirtualMachineBootMethod

Selects the boot method for the virtual machine.

VirtualMachineDetailedStatus

The more detailed status of the virtual machine.

VirtualMachineDeviceModelType

The type of the device model to use.

VirtualMachineIPAllocationMethod

The IP allocation mechanism for the virtual machine. Dynamic and Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the only permitted value.

VirtualMachineIsolateEmulatorThread

Field Deprecated, the value will be ignored if provided. The indicator of whether one of the specified CPU cores is isolated to run the emulator thread for this virtual machine.

VirtualMachineList

VirtualMachineList represents a list of virtual machines.

VirtualMachinePlacementHint

VirtualMachinePlacementHint represents a single scheduling hint of the virtual machine.

VirtualMachinePlacementHintPodAffinityScope

The scope for the virtual machine affinity or anti-affinity placement hint. It should always be "Machine" in the case of node affinity.

VirtualMachinePlacementHintType

The specification of whether this hint supports affinity or anti-affinity with the referenced resources.

VirtualMachinePowerState

The power state of the virtual machine.

VirtualMachineProvisioningState

The provisioning state of the virtual machine.

VirtualMachineSchedulingExecution

The indicator of whether the hint is a hard or soft requirement during scheduling.

VirtualMachineVirtioInterfaceType

Field Deprecated, use virtualizationModel instead. The type of the virtio interface.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

DefaultGateway

The indicator of whether this is the default gateway. Only one of the attached networks (including the CloudServicesNetwork attachment) for a single machine may be specified as True.

Value Description
True
False

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

ExtendedLocation

ExtendedLocation represents the Azure custom location where the resource will be created.

Name Type Description
name

string

The resource ID of the extended location on which the resource will be created.

type

string

The extended location type, for example, CustomLocation.

ImageRepositoryCredentials

ImageRepositoryCredentials represents the credentials used to login to the image repository.

Name Type Description
password

string

minLength: 1

The password or token used to access an image in the target repository.

registryUrl

string

The URL of the authentication server used to validate the repository credentials.

username

string

minLength: 1

The username used to access an image in the target repository.

NetworkAttachment

NetworkAttachment represents the single network attachment.

Name Type Description
attachedNetworkId

string (arm-id)

The resource ID of the associated network attached to the virtual machine. It can be one of cloudServicesNetwork, l3Network, l2Network or trunkedNetwork resources.

defaultGateway

DefaultGateway

The indicator of whether this is the default gateway. Only one of the attached networks (including the CloudServicesNetwork attachment) for a single machine may be specified as True.

ipAllocationMethod

VirtualMachineIPAllocationMethod

The IP allocation mechanism for the virtual machine. Dynamic and Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the only permitted value.

ipv4Address

string

The IPv4 address of the virtual machine.

This field is used only if the attached network has IPAllocationType of IPV4 or DualStack.

If IPAllocationMethod is: Static - this field must contain a user specified IPv4 address from within the subnet specified in the attached network. Dynamic - this field is read-only, but will be populated with an address from within the subnet specified in the attached network. Disabled - this field will be empty.

ipv6Address

string

The IPv6 address of the virtual machine.

This field is used only if the attached network has IPAllocationType of IPV6 or DualStack.

If IPAllocationMethod is: Static - this field must contain an IPv6 address range from within the range specified in the attached network. Dynamic - this field is read-only, but will be populated with an range from within the subnet specified in the attached network. Disabled - this field will be empty.

macAddress

string

The MAC address of the interface for the virtual machine that corresponds to this network attachment.

networkAttachmentName

string

maxLength: 15

The associated network's interface name. If specified, the network attachment name has a maximum length of 15 characters and must be unique to this virtual machine. If the user doesn’t specify this value, the default interface name of the network resource will be used. For a CloudServicesNetwork resource, this name will be ignored.

OsDisk

OsDisk represents configuration of the boot disk.

Name Type Default value Description
createOption

OsDiskCreateOption

Ephemeral

The strategy for creating the OS disk.

deleteOption

OsDiskDeleteOption

Delete

The strategy for deleting the OS disk.

diskSizeGB

integer (int64)

The size of the disk. Required if the createOption is Ephemeral. Allocations are measured in gibibytes.

OsDiskCreateOption

The strategy for creating the OS disk.

Value Description
Ephemeral

OsDiskDeleteOption

The strategy for deleting the OS disk.

Value Description
Delete

SshPublicKey

SshPublicKey represents the public key used to authenticate with a resource through SSH.

Name Type Description
keyData

string

minLength: 1

The SSH public key data.

StorageProfile

StorageProfile represents information about a disk.

Name Type Description
osDisk

OsDisk

OsDisk represents configuration of the boot disk.
The disk to use with this virtual machine.

volumeAttachments

string[]

The resource IDs of volumes that are requested to be attached to the virtual machine.

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.

VirtualMachine

VirtualMachine represents the on-premises Network Cloud virtual machine.

Name Type Default value Description
extendedLocation

ExtendedLocation

ExtendedLocation represents the Azure custom location where the resource will be created.
The extended location of the cluster associated with the resource.

id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

location

string

The geo-location where the resource lives

name

string

The name of the resource

properties.adminUsername

string

minLength: 1
maxLength: 32
pattern: ^[a-z_][a-z0-9_]{0,31}$

The name of the administrator to which the ssh public keys will be added into the authorized keys.

properties.availabilityZone

string

The cluster availability zone containing this virtual machine.

properties.bareMetalMachineId

string (arm-id)

The resource ID of the bare metal machine that hosts the virtual machine.

properties.bootMethod

VirtualMachineBootMethod

UEFI

Selects the boot method for the virtual machine.

properties.cloudServicesNetworkAttachment

NetworkAttachment

NetworkAttachment represents the single network attachment.
The cloud service network that provides platform-level services for the virtual machine.

properties.clusterId

string (arm-id)

The resource ID of the cluster the virtual machine is created for.

properties.cpuCores

integer (int64)

minimum: 2

The number of CPU cores in the virtual machine.

properties.detailedStatus

VirtualMachineDetailedStatus

The more detailed status of the virtual machine.

properties.detailedStatusMessage

string

The descriptive message about the current detailed status.

properties.isolateEmulatorThread

VirtualMachineIsolateEmulatorThread

True

Field Deprecated, the value will be ignored if provided. The indicator of whether one of the specified CPU cores is isolated to run the emulator thread for this virtual machine.

properties.memorySizeGB

integer (int64)

minimum: 1

The memory size of the virtual machine. Allocations are measured in gibibytes.

properties.networkAttachments

NetworkAttachment[]

The list of network attachments to the virtual machine.

properties.networkData

string

The Base64 encoded cloud-init network data.

properties.placementHints

VirtualMachinePlacementHint[]

The scheduling hints for the virtual machine.

properties.powerState

VirtualMachinePowerState

The power state of the virtual machine.

properties.provisioningState

VirtualMachineProvisioningState

The provisioning state of the virtual machine.

properties.sshPublicKeys

SshPublicKey[]

The list of ssh public keys. Each key will be added to the virtual machine using the cloud-init ssh_authorized_keys mechanism for the adminUsername.

properties.storageProfile

StorageProfile

StorageProfile represents information about a disk.
The storage profile that specifies size and other parameters about the disks related to the virtual machine.

properties.userData

string

The Base64 encoded cloud-init user data.

properties.virtioInterface

VirtualMachineVirtioInterfaceType

Modern

Field Deprecated, use virtualizationModel instead. The type of the virtio interface.

properties.vmDeviceModel

VirtualMachineDeviceModelType

T2

The type of the device model to use.

properties.vmImage

string

The virtual machine image that is currently provisioned to the OS disk, using the full url and tag notation used to pull the image.

properties.vmImageRepositoryCredentials

ImageRepositoryCredentials

ImageRepositoryCredentials represents the credentials used to login to the image repository.
The credentials used to login to the image repository that has access to the specified image.

properties.volumes

string[]

The resource IDs of volumes that are attached to the virtual machine.

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

tags

object

Resource tags.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

VirtualMachineBootMethod

Selects the boot method for the virtual machine.

Value Description
UEFI
BIOS

VirtualMachineDetailedStatus

The more detailed status of the virtual machine.

Value Description
Available
Error
Provisioning
Running
Scheduling
Stopped
Terminating
Unknown

VirtualMachineDeviceModelType

The type of the device model to use.

Value Description
T1
T2

VirtualMachineIPAllocationMethod

The IP allocation mechanism for the virtual machine. Dynamic and Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the only permitted value.

Value Description
Dynamic
Static
Disabled

VirtualMachineIsolateEmulatorThread

Field Deprecated, the value will be ignored if provided. The indicator of whether one of the specified CPU cores is isolated to run the emulator thread for this virtual machine.

Value Description
True
False

VirtualMachineList

VirtualMachineList represents a list of virtual machines.

Name Type Description
nextLink

string

The link used to get the next page of operations.

value

VirtualMachine[]

The list of virtual machines.

VirtualMachinePlacementHint

VirtualMachinePlacementHint represents a single scheduling hint of the virtual machine.

Name Type Description
hintType

VirtualMachinePlacementHintType

The specification of whether this hint supports affinity or anti-affinity with the referenced resources.

resourceId

string (arm-id)

The resource ID of the target object that the placement hints will be checked against, e.g., the bare metal node to host the virtual machine.

schedulingExecution

VirtualMachineSchedulingExecution

The indicator of whether the hint is a hard or soft requirement during scheduling.

scope

VirtualMachinePlacementHintPodAffinityScope

The scope for the virtual machine affinity or anti-affinity placement hint. It should always be "Machine" in the case of node affinity.

VirtualMachinePlacementHintPodAffinityScope

The scope for the virtual machine affinity or anti-affinity placement hint. It should always be "Machine" in the case of node affinity.

Value Description
Rack
Machine

VirtualMachinePlacementHintType

The specification of whether this hint supports affinity or anti-affinity with the referenced resources.

Value Description
Affinity
AntiAffinity

VirtualMachinePowerState

The power state of the virtual machine.

Value Description
On
Off
Unknown

VirtualMachineProvisioningState

The provisioning state of the virtual machine.

Value Description
Succeeded
Failed
Canceled
Provisioning
Accepted

VirtualMachineSchedulingExecution

The indicator of whether the hint is a hard or soft requirement during scheduling.

Value Description
Hard
Soft

VirtualMachineVirtioInterfaceType

Field Deprecated, use virtualizationModel instead. The type of the virtio interface.

Value Description
Modern
Transitional