Virtual Machines - List By Lab
Get all virtual machines for a lab.
Returns a list of all virtual machines for a lab.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines?api-version=2023-06-07
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines?api-version=2023-06-07&$filter={$filter}
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
lab
|
path | True |
string |
The name of the lab that uniquely identifies it within containing lab plan. Used in resource URIs. |
resource
|
path | True |
string |
The name of the resource group. The name is case insensitive. |
subscription
|
path | True |
string |
The ID of the target subscription. |
api-version
|
query | True |
string |
The API version to use for this operation. |
$filter
|
query |
string |
The filter to apply to the operation. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
The request was successful; response contains all virtual machines for the given lab. |
|
Other Status Codes |
The default error response. |
Examples
listVirtualMachine
Sample request
GET https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/virtualMachines?api-version=2023-06-07
Sample response
{
"nextLink": null,
"value": [
{
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/virtualMachines/template",
"name": "default",
"type": "Microsoft.LabServices/VirtualMachine",
"systemData": {
"createdBy": "identity123",
"createdByType": "User",
"createdAt": "2020-05-01T10:00:00Z",
"lastModifiedBy": "identity123",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-06-01T09:12:28Z"
},
"properties": {
"provisioningState": "Succeeded",
"state": "Running",
"connectionProfile": {
"privateIpAddress": "192.168.2.1",
"sshAuthority": "vm-42.contoso.com:22",
"sshInBrowserUrl": "vm-42.contoso.com",
"rdpAuthority": "vm-42.contoso.com:3389",
"rdpInBrowserUrl": "vm-42.contoso.com",
"adminUsername": "user123"
},
"claimedByUserId": "testuser567",
"vmType": "Template"
}
}
]
}
Definitions
Name | Description |
---|---|
created |
The type of identity that created the resource. |
Error |
The resource management error additional info. |
Error |
The error detail. |
Error |
Error response |
Paged |
Paged list of lab services virtual machines. |
Provisioning |
Current provisioning state of the virtual machine. |
Resource |
Error details of the latest operation failure on this resource |
system |
Metadata pertaining to creation and last modification of the resource. |
Virtual |
A lab virtual machine resource. |
Virtual |
The connection information for the virtual machine |
Virtual |
The state of a virtual machine. |
Virtual |
The type of the lab virtual machine. |
createdByType
The type of identity that created the resource.
Name | Type | Description |
---|---|---|
Application |
string |
|
Key |
string |
|
ManagedIdentity |
string |
|
User |
string |
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 |
The error additional info. |
|
code |
string |
The error code. |
details |
The error details. |
|
message |
string |
The error message. |
target |
string |
The error target. |
ErrorResponse
Error response
Name | Type | Description |
---|---|---|
error |
The error object. |
PagedVirtualMachines
Paged list of lab services virtual machines.
Name | Type | Description |
---|---|---|
nextLink |
string |
The link to get the next page of virtual machine results. |
value |
The array page of virtual machine results. |
ProvisioningState
Current provisioning state of the virtual machine.
Name | Type | Description |
---|---|---|
Creating |
string |
Resource is in the process of being created. |
Deleting |
string |
Resource is in the process of being deleted. |
Failed |
string |
Previous operation on the resource has failed leaving resource in unhealthy state. |
Locked |
string |
The resource is locked and changes are currently blocked. This could be due to maintenance or a scheduled operation. The state will go back to succeeded once the locking operation has finished. |
Succeeded |
string |
Resource is in healthy state after creation or update operation. |
Updating |
string |
New property values are being applied to the resource. |
ResourceOperationError
Error details of the latest operation failure on this resource
Name | Type | Description |
---|---|---|
action |
string |
The operation action that failed |
code |
string |
The code that corresponds to the type of operation failure |
message |
string |
The operation failure message |
timestamp |
string |
The datetime of when the error occured |
systemData
Metadata pertaining to creation and last modification of the resource.
Name | Type | Description |
---|---|---|
createdAt |
string |
The timestamp of resource creation (UTC). |
createdBy |
string |
The identity that created the resource. |
createdByType |
The type of identity that created the resource. |
|
lastModifiedAt |
string |
The timestamp of resource last modification (UTC) |
lastModifiedBy |
string |
The identity that last modified the resource. |
lastModifiedByType |
The type of identity that last modified the resource. |
VirtualMachine
A lab virtual machine resource.
Name | Type | Description |
---|---|---|
id |
string |
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
name |
string |
The name of the resource |
properties.claimedByUserId |
string |
The lab user ID (not the PUID!) of who claimed the virtual machine. |
properties.connectionProfile |
Profile for information about connecting to the virtual machine. |
|
properties.provisioningState |
Current provisioning state of the virtual machine. |
|
properties.resourceOperationError |
Error details of last operation done on lab plan. |
|
properties.state |
The current state of the virtual machine |
|
properties.vmType |
The type of this VM resource |
|
systemData |
System data of the Lab virtual machine. |
|
type |
string |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" |
VirtualMachineConnectionProfile
The connection information for the virtual machine
Name | Type | Description |
---|---|---|
adminUsername |
string |
The username used to log on to the virtual machine as admin. |
nonAdminUsername |
string |
The username used to log on to the virtual machine as non-admin, if one exists. |
privateIpAddress |
string |
The private IP address of the virtual machine. |
rdpAuthority |
string |
Port and host name separated by semicolon for connecting via RDP protocol to the virtual machine. |
rdpInBrowserUrl |
string |
URL for connecting via RDP protocol to the virtual machine in browser. |
sshAuthority |
string |
Port and host name separated by semicolon for connecting via SSH protocol to the virtual machine. |
sshInBrowserUrl |
string |
URL for connecting via SSH protocol to the virtual machine in browser. |
VirtualMachineState
The state of a virtual machine.
Name | Type | Description |
---|---|---|
Redeploying |
string |
The VM is being redeployed. |
Reimaging |
string |
The VM is being reimaged. |
ResettingPassword |
string |
The VM password is being reset. |
Running |
string |
The VM is running. |
Starting |
string |
The VM is starting. |
Stopped |
string |
The VM is currently stopped. |
Stopping |
string |
The VM is stopping. |
VirtualMachineType
The type of the lab virtual machine.
Name | Type | Description |
---|---|---|
Template |
string |
A template VM |
User |
string |
A user VM |