获取 cloudPC

命名空间:microsoft.graph

重要

Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

读取特定 cloudPC 对象的属性和关系。

API 可用性

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ✅ ❌ ❌

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。

权限类型 最低特权权限 更高特权权限
委派(工作或学校帐户) CloudPC.Read.All CloudPC.ReadWrite.All
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 CloudPC.Read.All CloudPC.ReadWrite.All

HTTP 请求

若要获取指定用户的 cloudPC (该用户是使用委派权限在组织中登录的用户) :

GET /me/cloudPCs/{id}
GET /users/{userId}/cloudPCs/{id}

若要获取组织中的指定 cloudPC ,使用委派权限 (登录用户应为管理员) 或应用程序权限:

GET /deviceManagement/virtualEndpoint/cloudPCs/{id}

可选的查询参数

此方法支持 $selectOData 查询参数 ,以帮助自定义响应。

请求标头

名称 说明
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权。

请求正文

请勿提供此方法的请求正文。

响应

如果成功,此方法将在响应正文中返回 200 OK 响应代码和 cloudPC 对象。

示例

示例 1:获取云电脑的默认属性

请求

以下示例显示了一个请求。

GET https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs/9ec90ff8-fd63-4fb9-ab5a-aa4fdcc43ec9

响应

以下示例显示了相应的响应。

HTTP/1.1 200 OK
Content-Type: application/json

{
    "@odata.type": "#microsoft.graph.cloudPC",
    "aadDeviceId": "f5ff445f-7488-40f8-8ab9-ee784a9c1f33",
    "id": "ac74ae8b-85f7-4272-88cc-54192674ffff",
    "displayName": "Demo-0",
    "imageDisplayName": "Windows-10 19h1-evd",
    "managedDeviceId": "e87f50c7-fa7f-4687-aade-dd45f3d6ffff",
    "managedDeviceName": "A00002GI001",
    "provisioningPolicyId": "13fa0778-ba00-438a-96d3-488c8602ffff",
    "provisioningPolicyName": "Marketing provisioning policy",
    "onPremisesConnectionName": "Azure network connection for Marketing",
    "servicePlanId": "da5615b4-a484-4742-a019-2d52c91cffff",
    "servicePlanName": "standard",
    "servicePlanType": "enterprise",
    "status": "failed",
    "statusDetails": {
    "@odata.type": "microsoft.graph.cloudPcStatusDetails",
    "code": "internalServerError",
    "message": "There was an internal server error. Please contact support xxx.",
    "additionalInformation": [
        {
          "@odata.type": "microsoft.graph.keyValuePair",
          "name": "correlationId",
          "value": "52367774-cfb7-4e9c-ab51-1b864c31f2d1"
        }
      ]
    },
    "userPrincipalName": "pmitchell@contoso.com",
    "lastModifiedDateTime": "2020-11-03T18:14:34Z",
    "gracePeriodEndDateTime": "2020-11-010T20:00:34Z",
    "provisioningType": "sharedByUser",
    "diskEncryptionState": "notAvailable"
}

示例 2:获取云电脑的所选属性

以下示例演示如何使用 OData 查询参数获取 cloudPC 对象 $select 的选定属性。

请求

以下示例显示了一个请求。

GET https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs/40cee9d2-03fb-4066-8d35-dbdf2875c33f?$select=id,displayName,imageDisplayName,lastModifiedDateTime,lastRemoteActionResult,lastLoginResult,lastLogoffDateTime,connectivityResult,allotmentDisplayName,deviceRegionName,productType,provisionedDateTime,sharedDeviceDetail,groupDetail,userDetail

响应

以下示例显示了相应的响应。

HTTP/1.1 200 OK
Content-Type: application/json

{
    "@odata.type": "#microsoft.graph.cloudPC",
    "id": "ac74ae8b-85f7-4272-88cc-54192674ffff",
    "displayName": "Demo-0",
    "imageDisplayName": "Windows-10 19h1-evd",
    "lastModifiedDateTime": "2020-11-03T18:14:34Z",
    "lastLoginResult": {
        "time": "2021-06-23T09:28:32.8260335Z"
    },
    "lastLogoffDateTime": "2021-06-23T10:15:00Z",
    "lastRemoteActionResult": {
      "actionName": "Reboot",
      "actionState": "done",
      "startDateTime": "2021-06-23T09:28:32.8260335Z",
      "lastUpdatedDateTime": "2021-06-23T09:28:32.8260338Z",
      "cloudPcId": "662009bc-7732-4f6f-8726-25883518b33e",
      "managedDeviceId": "bdc8e6dd-0455-4412-83d9-c818664fe1f1",
      "statusDetails": null
    },
    "connectivityResult": {
      "failedHealthCheckItems": [
        {
          "additionalDetails": "SessionHost unhealthy: SessionHost is not joined to a domain",
          "displayName": "DomainJoinCheck",
          "lastHealthCheckDateTime": "2022-03-22T10:28:32.8260335Z",
          "result": "failure"
        }
      ],
      "status": "unavailable",
      "updatedDateTime": "2022-03-22T10:28:32.8260335Z",
      "lastModifiedDateTime": "2022-03-22T10:28:32.8260335Z"
    },
    "allotmentDisplayName": null,
    "deviceRegionName": "eastus2",
    "productType": null,
    "provisionedDateTime": "2025-04-23T10:29:57Z",
    "sharedDeviceDetail": {
      "assignedToUserPrincipalName": "john.doe@contoso.onmicrosoft.com",
      "sessionStartDateTime": "2025-09-08T10:10:00Z"
    },
    "groupDetail": {
        "groupId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "groupDisplayName": "Contoso Cloud PC Users"
    },
    "userDetail": {
        "userId": "e798de27-1806-4433-9ac3-4db7a985a12b",
        "userDisplayName": "Peter Mitchell"
    }
}

示例 3:获取已登录用户的云电脑的默认属性

请求

以下示例显示了一个请求。

GET https://graph.microsoft.com/beta/me/cloudPCs/36bd4942-0ca8-11ed-861d-0242ac120002

响应

以下示例显示了相应的响应。

HTTP/1.1 200 OK
Content-Type: application/json

{
    "@odata.type": "#microsoft.graph.cloudPC",
    "aadDeviceId": "61204a22-0ca8-11ed-861d-0242ac120002",
    "id": "36bd4942-0ca8-11ed-861d-0242ac120002",
    "displayName": "Demo-1",
    "imageDisplayName": "Windows-10 19h1-evd",
    "managedDeviceId": "70341bb0-0ca8-11ed-861d-0242ac120002",
    "managedDeviceName": "A00002GI001",
    "provisioningPolicyId": "7a3bdee0-0ca8-11ed-861d-0242ac120002",
    "provisioningPolicyName": "Marketing provisioning policy",
    "onPremisesConnectionName": "Azure network connection for Marketing",
    "servicePlanId": "83fca22a-0ca8-11ed-861d-0242ac120002",
    "servicePlanName": "standard",
    "servicePlanType": "enterprise",
    "status": "failed",
    "statusDetails": {
    "@odata.type": "microsoft.graph.cloudPcStatusDetails",
    "code": "internalServerError",
    "message": "There was an internal server error. Please contact support xxx.",
    "additionalInformation": [
        {
          "@odata.type": "microsoft.graph.keyValuePair",
          "name": "correlationId",
          "value": "8fea34e4-0ca8-11ed-861d-0242ac120002"
        }
      ]
    },
    "userPrincipalName": "pmitchell@contoso.com",
    "lastModifiedDateTime": "2020-11-03T18:14:34Z",
    "gracePeriodEndDateTime": "2020-11-010T20:00:34Z",
    "provisioningType": "dedicated",
    "diskEncryptionState": "notAvailable"
}