cloudPC:重新设置
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
重新设置特定的云电脑。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
CloudPC.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| 应用程序 |
CloudPC.ReadWrite.All |
HTTP 请求
POST /deviceManagement/virtualEndpoint/cloudPCs/{id}/reprovision
| 名称 |
说明 |
| Authorization |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
在请求正文中,提供参数的 JSON 表示形式。
下表显示了可用于此操作的参数。
| 参数 |
类型 |
说明 |
| osVersion |
cloudPcOperatingSystem |
操作系统版本 (操作系统) 在云 PC 上预配。 可能的值是:、windows10``windows11和 unknownFutureValue。 |
| userAccountType |
cloudPcUserAccountType |
已预配云 PC 上的用户的帐户类型。 可能的值是:、standardUser``administrator和 unknownFutureValue。 |
响应
如果成功,此方法返回 204 No Content 响应代码。
示例
请求
POST https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs/4b5ad5e0-6a0b-4ffc-818d-36bb23cf4dbd/reprovision
Content-Type: application/json
Content-length: 61
{
"userAccountType": "administrator",
"osVersion": "windows10"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var userAccountType = CloudPcUserAccountType.Administrator;
var osVersion = CloudPcOperatingSystem.Windows10;
await graphClient.DeviceManagement.VirtualEndpoint.CloudPCs["{cloudPC-id}"]
.Reprovision(userAccountType,osVersion)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const reprovision = {
userAccountType: 'administrator',
osVersion: 'windows10'
};
await client.api('/deviceManagement/virtualEndpoint/cloudPCs/4b5ad5e0-6a0b-4ffc-818d-36bb23cf4dbd/reprovision')
.version('beta')
.post(reprovision);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/deviceManagement/virtualEndpoint/cloudPCs/4b5ad5e0-6a0b-4ffc-818d-36bb23cf4dbd/reprovision"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
MSGraphCloudPcUserAccountType *userAccountType = [MSGraphCloudPcUserAccountType administrator];
payloadDictionary[@"userAccountType"] = userAccountType;
MSGraphCloudPcOperatingSystem *osVersion = [MSGraphCloudPcOperatingSystem windows10];
payloadDictionary[@"osVersion"] = osVersion;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
CloudPcUserAccountType userAccountType = CloudPcUserAccountType.ADMINISTRATOR;
CloudPcOperatingSystem osVersion = CloudPcOperatingSystem.WINDOWS10;
graphClient.deviceManagement().virtualEndpoint().cloudPCs("4b5ad5e0-6a0b-4ffc-818d-36bb23cf4dbd")
.reprovision(CloudPCReprovisionParameterSet
.newBuilder()
.withUserAccountType(userAccountType)
.withOsVersion(osVersion)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
userAccountType := "administrator"
requestBody.SetUserAccountType(&userAccountType)
osVersion := "windows10"
requestBody.SetOsVersion(&osVersion)
cloudPCId := "cloudPC-id"
graphClient.DeviceManagement().VirtualEndpoint().CloudPCsById(&cloudPCId).Reprovision(cloudPC-id).Post(requestBody)
Import-Module Microsoft.Graph.DeviceManagement.Actions
$params = @{
UserAccountType = "administrator"
OsVersion = "windows10"
}
Invoke-MgReprovisionDeviceManagementVirtualEndpointCloudPc -CloudPCId $cloudPCId -BodyParameter $params
响应
HTTP/1.1 204 No Content