Virtual Machines - List By 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 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
lab
|
path | True |
string minLength: 1maxLength: 100 |
唯一标识包含实验室计划的实验室的名称。 在资源 URI 中使用。 |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
资源组的名称。 名称不区分大小写。 |
|
subscription
|
path | True |
string minLength: 1 |
目标订阅的 ID。 |
|
api-version
|
query | True |
string minLength: 1 |
用于此作的 API 版本。 |
|
$filter
|
query |
string |
要应用于作的筛选器。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
请求成功;响应包含给定实验室的所有虚拟机。 |
|
| Other Status Codes |
默认错误响应。 |
示例
listVirtualMachine
示例请求
GET https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/virtualMachines?api-version=2023-06-07
示例响应
{
"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"
}
}
]
}
定义
| 名称 | 说明 |
|---|---|
|
created |
创建资源的标识的类型。 |
|
Error |
资源管理错误附加信息。 |
|
Error |
错误详细信息。 |
|
Error |
错误响应 |
|
Paged |
实验室服务虚拟机的分页列表。 |
|
Provisioning |
虚拟机的当前预配状态。 |
|
Resource |
有关此资源上最新作失败的错误详细信息 |
|
system |
与创建和上次修改资源相关的元数据。 |
|
Virtual |
实验室虚拟机资源。 |
|
Virtual |
虚拟机的连接信息 |
|
Virtual |
虚拟机的状态。 |
|
Virtual |
实验室虚拟机的类型。 |
createdByType
创建资源的标识的类型。
| 值 | 说明 |
|---|---|
| User | |
| Application | |
| ManagedIdentity | |
| Key |
ErrorAdditionalInfo
资源管理错误附加信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| info |
object |
其他信息。 |
| type |
string |
其他信息类型。 |
ErrorDetail
错误详细信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| additionalInfo |
错误附加信息。 |
|
| code |
string |
错误代码。 |
| details |
错误详细信息。 |
|
| message |
string |
错误消息。 |
| target |
string |
错误目标。 |
ErrorResponse
错误响应
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误对象。 |
PagedVirtualMachines
实验室服务虚拟机的分页列表。
| 名称 | 类型 | 说明 |
|---|---|---|
| nextLink |
string |
用于获取虚拟机结果的下一页的链接。 |
| value |
虚拟机结果的数组页。 |
ProvisioningState
虚拟机的当前预配状态。
| 值 | 说明 |
|---|---|
| Creating |
正在创建资源。 |
| Updating |
正在向资源应用新的属性值。 |
| Deleting |
正在删除资源。 |
| Succeeded |
创建或更新作后,资源处于正常状态。 |
| Failed |
对资源的上一次作失败,导致资源处于不正常状态。 |
| Locked |
资源已锁定,当前阻止更改。 这可能是由于维护或计划的作造成的。 锁定作完成后,状态将恢复为成功。 |
ResourceOperationError
有关此资源上最新作失败的错误详细信息
| 名称 | 类型 | 说明 |
|---|---|---|
| action |
string |
失败的作作 |
| code |
string |
对应于作失败类型的代码 |
| message |
string |
作失败消息 |
| timestamp |
string (date-time) |
发生错误的日期/时间 |
systemData
与创建和上次修改资源相关的元数据。
| 名称 | 类型 | 说明 |
|---|---|---|
| createdAt |
string (date-time) |
资源创建时间戳(UTC)。 |
| createdBy |
string |
创建资源的标识。 |
| createdByType |
创建资源的标识的类型。 |
|
| lastModifiedAt |
string (date-time) |
上次修改的资源时间戳(UTC) |
| lastModifiedBy |
string |
上次修改资源的标识。 |
| lastModifiedByType |
上次修改资源的标识的类型。 |
VirtualMachine
实验室虚拟机资源。
| 名称 | 类型 | 说明 |
|---|---|---|
| id |
string |
资源的完全限定资源 ID。 示例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
| name |
string |
资源的名称 |
| properties.claimedByUserId |
string |
声明虚拟机的实验室用户 ID(而不是 PUID!)。 |
| properties.connectionProfile |
有关连接到虚拟机的信息的配置文件。 |
|
| properties.provisioningState |
虚拟机的当前预配状态。 |
|
| properties.resourceOperationError |
上次在实验室计划中完成的作的错误详细信息。 |
|
| properties.state |
虚拟机的当前状态 |
|
| properties.vmType |
此 VM 资源的类型 |
|
| systemData |
实验室虚拟机的系统数据。 |
|
| type |
string |
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts” |
VirtualMachineConnectionProfile
虚拟机的连接信息
| 名称 | 类型 | 说明 |
|---|---|---|
| adminUsername |
string |
用于以管理员身份登录到虚拟机的用户名。 |
| nonAdminUsername |
string |
用于以非管理员身份登录到虚拟机的用户名(如果存在)。 |
| privateIpAddress |
string |
虚拟机的专用 IP 地址。 |
| rdpAuthority |
string |
端口和主机名用分号分隔,用于通过 RDP 协议连接到虚拟机。 |
| rdpInBrowserUrl |
string minLength: 3maxLength: 2000 |
用于在浏览器中通过 RDP 协议连接到虚拟机的 URL。 |
| sshAuthority |
string |
端口和主机名用分号分隔,用于通过 SSH 协议连接到虚拟机。 |
| sshInBrowserUrl |
string minLength: 3maxLength: 2000 |
用于在浏览器中通过 SSH 协议连接到虚拟机的 URL。 |
VirtualMachineState
虚拟机的状态。
| 值 | 说明 |
|---|---|
| Stopped |
VM 当前已停止。 |
| Starting |
VM 正在启动。 |
| Running |
VM 正在运行。 |
| Stopping |
VM 正在停止。 |
| ResettingPassword |
正在重置 VM 密码。 |
| Reimaging |
VM 正在重新映像。 |
| Redeploying |
正在重新部署 VM。 |
VirtualMachineType
实验室虚拟机的类型。
| 值 | 说明 |
|---|---|
| User |
用户 VM |
| Template |
模板 VM |