命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
为Microsoft Entra用户组下的用户获取特定服务计划的所有预配云电脑。
此 API 可用于以下国家级云部署。
全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
✅ |
✅ |
✅ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 |
最低特权权限 |
更高特权权限 |
委派(工作或学校帐户) |
CloudPC.Read.All |
CloudPC.ReadWrite.All |
委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
应用程序 |
CloudPC.Read.All |
CloudPC.ReadWrite.All |
HTTP 请求
GET /deviceManagement/virtualEndpoint/cloudPCs/getProvisionedCloudPCs(groupId='{groupId}',servicePlanId='{servicePlanId}')
可选的查询参数
此方法支持 $select
OData 查询参数 来帮助自定义响应。 可以使用 $select
获取特定属性,包括默认情况下不返回的属性。
名称 |
说明 |
Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
请求参数
参数 |
类型 |
说明 |
groupId |
String |
Microsoft Entra用户组的唯一标识符。 |
servicePlanId |
String |
服务计划的唯一标识符。 |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回响应 200 OK
代码和 cloudPC 对象集合。
示例
示例 1:获取所有预配的云电脑及其默认属性
以下示例演示如何获取所有预配的云电脑及其默认属性。
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs/getProvisionedCloudPCs(groupId='30d0e128-de93-41dc-89ec-33d84bb662a0',servicePlanId='9ecf691d-8b82-46cb-b254-cd061b2c02fb')
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.VirtualEndpoint.CloudPCs.GetProvisionedCloudPCsWithGroupIdWithServicePlanId("{groupId}","{servicePlanId}").GetAsGetProvisionedCloudPCsWithGroupIdWithServicePlanIdGetResponseAsync();
mgc-beta device-management virtual-endpoint cloud-pcs get-provisioned-cloud-pcs-with-group-id-with-service-plan-id get --group-id {group-id} --service-plan-id {service-plan-id}
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
groupId := "{groupId}"
servicePlanId := "{servicePlanId}"
getProvisionedCloudPCs, err := graphClient.DeviceManagement().VirtualEndpoint().CloudPCs().GetProvisionedCloudPCsWithGroupIdWithServicePlanId(&groupId, &servicePlanId).GetAsGetProvisionedCloudPCsWithGroupIdWithServicePlanIdGetResponse(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
var result = graphClient.deviceManagement().virtualEndpoint().cloudPCs().getProvisionedCloudPCsWithGroupIdWithServicePlanId("{groupId}", "{servicePlanId}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let getProvisionedCloudPCs = await client.api('/deviceManagement/virtualEndpoint/cloudPCs/getProvisionedCloudPCs(groupId='30d0e128-de93-41dc-89ec-33d84bb662a0',servicePlanId='9ecf691d-8b82-46cb-b254-cd061b2c02fb')')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->deviceManagement()->virtualEndpoint()->cloudPCs()->getProvisionedCloudPCsWithGroupIdWithServicePlanId('{groupId}', '{servicePlanId}', )->get()->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.device_management.virtual_endpoint.cloud_p_cs.get_provisioned_cloud_p_cs_with_group_id_with_service_plan_id("{groupId}","{servicePlanId}").get()
响应
以下示例显示了相应的响应。 它仅包括默认属性。
注意:为了提高可读性,可能缩短了此处显示的响应对象。 在实际调用中会返回所有默认属性。
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.cloudPC",
"id": "662009bc-7732-4f6f-8726-25883518b33e",
"displayName": "Demo-0",
"imageDisplayName": "Windows-10 19h1-evd",
"aadDeviceId": "f5ff445f-7488-40f8-8ab9-ee784a9c1f33",
"diskEncryptionState": "encryptedUsingCustomerManagedKey",
"managedDeviceId": "bdc8e6dd-0455-4412-83d9-c818664fe1f1",
"managedDeviceName": "CPC-ps1-SHYL-46",
"provisioningPolicyId": "7ed725ad-0a00-4117-b557-d965c3732450",
"servicePlanId": "9ecf691d-8b82-46cb-b254-cd061b2c02fb",
"servicePlanName": "Cloud PC Enterprise 4vCPU/16GB/256GB",
"servicePlanType": "enterprise",
"status": "provisioned",
"userPrincipalName": "pmitchell@contoso.com",
"lastModifiedDateTime": "2020-07-23T10:29:57Z",
"statusDetails": null,
"provisioningType": "dedicated",
"allotmentDisplayName": null,
"deviceRegionName": "eastus2",
"gracePeriodEndDateTime": null,
"onPremisesConnectionName": "Test-OPNC",
"partnerAgentInstallResults": null,
"provisioningPolicyName": "Test-Policy"
},
{
"@odata.type": "#microsoft.graph.cloudPC",
"id": "ac74ae8b-85f7-4272-88cc-5419267403ed",
"displayName": "Demo-1",
"imageDisplayName": "Custom image name",
"aadDeviceId": "61289490-ef06-4962-8f49-455329c8893c",
"diskEncryptionState": "encryptedUsingCustomerManagedKey",
"managedDeviceId": "e87f50c7-fa7f-4687-aade-dd45f3d65970",
"managedDeviceName": "CPC-ps2-7ERZ-QE",
"provisioningPolicyId": "13fa0778-ba00-438a-96d3-488c86029dff",
"servicePlanId": "9ecf691d-8b82-46cb-b254-cd061b2c02fb",
"servicePlanName": "Cloud PC Enterprise 4vCPU/16GB/256GB",
"servicePlanType": "enterprise",
"status": "provisioned",
"userPrincipalName": "pmitchell@contoso.com",
"lastModifiedDateTime": "2020-07-28T18:14:34Z",
"statusDetails": null,
"provisioningType": "dedicated",
"allotmentDisplayName": null,
"deviceRegionName": "eastus2",
"gracePeriodEndDateTime": null,
"onPremisesConnectionName": "Test-OPNC",
"partnerAgentInstallResults": null,
"provisioningPolicyName": "Test-Policy"
}
]
}
示例 2:获取所有预配的云电脑和特定属性
以下示例演示如何获取所有预配的云电脑,并使用 $select
获取特定属性,包括默认情况下不返回的属性。
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs/getProvisionedCloudPCs(groupId='30d0e128-de93-41dc-89ec-33d84bb662a0',servicePlanId='9ecf691d-8b82-46cb-b254-cd061b2c02fb')?$select=id,displayName,powerState,connectivityResult,lastLoginResult,lastRemoteActionResult,osVersion,provisioningPolicyName,userAccountType,productType
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.VirtualEndpoint.CloudPCs.GetProvisionedCloudPCsWithGroupIdWithServicePlanId("{groupId}","{servicePlanId}").GetAsGetProvisionedCloudPCsWithGroupIdWithServicePlanIdGetResponseAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string []{ "id","displayName","powerState","connectivityResult","lastLoginResult","lastRemoteActionResult","osVersion","provisioningPolicyName","userAccountType","productType" };
});
mgc-beta device-management virtual-endpoint cloud-pcs get-provisioned-cloud-pcs-with-group-id-with-service-plan-id get --group-id {group-id} --service-plan-id {service-plan-id} --select "id,displayName,powerState,connectivityResult,lastLoginResult,lastRemoteActionResult,osVersion,provisioningPolicyName,userAccountType,productType"
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphdevicemanagement "github.com/microsoftgraph/msgraph-beta-sdk-go/devicemanagement"
//other-imports
)
requestParameters := &graphdevicemanagement.VirtualEndpointCloudPCsGetProvisionedCloudPCsWithGroupIdWithServicePlanIdRequestBuilderGetQueryParameters{
Select: [] string {"id","displayName","powerState","connectivityResult","lastLoginResult","lastRemoteActionResult","osVersion","provisioningPolicyName","userAccountType","productType"},
}
configuration := &graphdevicemanagement.VirtualEndpointCloudPCsGetProvisionedCloudPCsWithGroupIdWithServicePlanIdRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
groupId := "{groupId}"
servicePlanId := "{servicePlanId}"
getProvisionedCloudPCs, err := graphClient.DeviceManagement().VirtualEndpoint().CloudPCs().GetProvisionedCloudPCsWithGroupIdWithServicePlanId(&groupId, &servicePlanId).GetAsGetProvisionedCloudPCsWithGroupIdWithServicePlanIdGetResponse(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
var result = graphClient.deviceManagement().virtualEndpoint().cloudPCs().getProvisionedCloudPCsWithGroupIdWithServicePlanId("{groupId}", "{servicePlanId}").get(requestConfiguration -> {
requestConfiguration.queryParameters.select = new String []{"id", "displayName", "powerState", "connectivityResult", "lastLoginResult", "lastRemoteActionResult", "osVersion", "provisioningPolicyName", "userAccountType", "productType"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let getProvisionedCloudPCs = await client.api('/deviceManagement/virtualEndpoint/cloudPCs/getProvisionedCloudPCs(groupId='30d0e128-de93-41dc-89ec-33d84bb662a0',servicePlanId='9ecf691d-8b82-46cb-b254-cd061b2c02fb')')
.version('beta')
.select('id,displayName,powerState,connectivityResult,lastLoginResult,lastRemoteActionResult,osVersion,provisioningPolicyName,userAccountType,productType')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\DeviceManagement\VirtualEndpoint\CloudPCs\GetProvisionedCloudPCs(groupId='{groupId}',servicePlanId='{servicePlanId}')\GetProvisionedCloudPCsWithGroupIdWithServicePlanIdRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new GetProvisionedCloudPCsWithGroupIdWithServicePlanIdRequestBuilderGetRequestConfiguration();
$queryParameters = GetProvisionedCloudPCsWithGroupIdWithServicePlanIdRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->select = ["id","displayName","powerState","connectivityResult","lastLoginResult","lastRemoteActionResult","osVersion","provisioningPolicyName","userAccountType","productType"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->deviceManagement()->virtualEndpoint()->cloudPCs()->getProvisionedCloudPCsWithGroupIdWithServicePlanId('{groupId}', '{servicePlanId}', )->get($requestConfiguration)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.device_management.virtual_endpoint.cloud_p_cs.get_provisioned_cloud_p_cs(group_id='{group_id}',service_plan_id='{service_plan_id}').get_provisioned_cloud_p_cs_with_group_id_with_service_plan_id_request_builder import GetProvisionedCloudPCsWithGroupIdWithServicePlanIdRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = GetProvisionedCloudPCsWithGroupIdWithServicePlanIdRequestBuilder.GetProvisionedCloudPCsWithGroupIdWithServicePlanIdRequestBuilderGetQueryParameters(
select = ["id","displayName","powerState","connectivityResult","lastLoginResult","lastRemoteActionResult","osVersion","provisioningPolicyName","userAccountType","productType"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.device_management.virtual_endpoint.cloud_p_cs.get_provisioned_cloud_p_cs_with_group_id_with_service_plan_id("{groupId}","{servicePlanId}").get(request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.cloudPC",
"id": "662009bc-7732-4f6f-8726-25883518b33e",
"displayName": "Demo-0",
"powerState": "running",
"connectivityResult": "",
"lastLoginResult": "2020-07-23T10:29:57Z",
"lastRemoteActionResult": "Succeed",
"osVersion": null,
"provisioningPolicyName": "Test-Policy",
"userAccountType": null,
"productType": null
},
{
"@odata.type": "#microsoft.graph.cloudPC",
"id": "ac74ae8b-85f7-4272-88cc-5419267403ed",
"displayName": "Demo-1",
"powerState": "running",
"connectivityResult": "",
"lastLoginResult": "2020-07-23T10:29:57Z",
"lastRemoteActionResult": "Succeed",
"osVersion": null,
"provisioningPolicyName": "Test-Policy",
"userAccountType": null,
"productType": null
}
]
}