Edit

Share via


cloudpcprovisioningpolicy: schedulePolicyApplyTask

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Set a scheduled auto-reprovision task to do automatic regular apply. Frontline shared only. Administrators only.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) CloudPC.ReadWrite.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application CloudPC.ReadWrite.All Not available.

HTTP request

POST /deviceManagement/virtualEndpoint/provisioningPolicies/{id}/schedulePolicyApplyTask

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of the cloudpcpolicyscheduledapplyactiondetail object.

The following table shows the properties that can be supplied when you schedule a policy apply task.

Parameter Type Description
reservePercentage Int32 For Frontline shared only. The percentage of Cloud PCs to keep available. Administrators can set this property to a value from 0 to 99. Cloud PCs are reprovisioned only when there are no active and connected Cloud PC users.
cronScheduleExpression String Administrators can set a cron expression to define the scheduling rules for automatic regular apply. When auto provision is disabled, cronScheduleExpression is set to null, stopping the automatic task scheduling (ex. "0 0 0 20 * *" means schedules a job to run at midnight on the 20th of every month). Read-only.
startDateTime String Indicates IT Admins can set a start date to define the first scheduler run after this time. If not set, default is current time. There are no time zone information at this time, it needs to be coordinated with timezone, for example, "2025-01-01 00:00:00" with "China Standard Time" means the scheduling rule will take effect after Jan 01 2025 00:00:00 GMT+0800 (China Standard Time).
endDateTime String Indicates IT Admins can set an end date to define the last scheduler run before this time. If not set, the scheduler runs continuously. There are no time zone information at this time, it needs to be coordinated with timezone, for example, "2025-02-01 00:00:00" with "China Standard Time" means the scheduling rule will take effect before Feb 01 2025 00:00:00 GMT+0800 (China Standard Time).
timezone cloudPcPolicyTimezone Indicates IT Admins can set a timezone to define the timezone of nextRunDateTime, startDateTime, endDateTime, default is gmt. Possible values are gmt, bit, nut, hst, mit, akst, pst, mst, east, est, ast, nst, art, gst, azot, cet, cat, eat, get, pkt, ist, bst, tha, cst, jst, acst, pgt, sbt, fjt, tot, lint, and unknownFutureValue.

Response

If successful, this method returns a 202 ACCEPTED response code.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/provisioningPolicies/b0c2d35f-3385-46c8-a6f5-6c3dfad7708b/schedulePolicyApplyTask

{
  "reservePercentage": 50,
  "cronScheduleExpression": "0 0 0 20 * *",
  "startDateTime": "2025-03-12 00:00:00",
  "endDateTime": null,
  "timezone": "cst"
}

Response

The following example shows the response.

HTTP/1.1 204 No Content