Edit

cloudPC: setDeviceName

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 the operating system device name of a Cloud PC. This action runs asynchronously and changes the computer name, not the displayName property. To change the display name, use rename.

This action supports Windows 365 Enterprise and Windows 365 Flex (formerly Frontline) Cloud PCs in dedicated mode. Use getSupportedCloudPcRemoteActions to check whether the action is available for a Cloud PC.

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.

Note

For delegated access using work or school accounts, the signed-in user must have the CloudPCs/SetDeviceName permission through Windows 365 role-based access control, in addition to the Microsoft Graph permission. The Cloud PC Administrator role or a custom role that grants this permission can be used. Supported Microsoft Entra roles include Windows 365 Administrator and Intune Administrator.

For scoped role assignments, the target Cloud PC must also be within the user's assigned scope groups and scope tags. These user role requirements don't apply to application-only access.

HTTP request

POST /deviceManagement/virtualEndpoint/cloudPCs/{cloudPC-id}/setDeviceName

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 parameters.

The following table lists the parameters that are required when you call this action.

Parameter Type Description
deviceName String The device name to assign to the Cloud PC. Required. Must be 5–15 characters and contain only ASCII letters, digits, or hyphens. The name must not consist entirely of digits and must be unique within the tenant. Use a name that doesn't start with a hyphen.

Response

If successful, this action returns a 204 No Content response code. A successful response doesn't mean that the device name changed or that Intune synchronized the change. Use retrieveCloudPcRemoteActionResults to check the remote action result.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs/b0a9cde2-e170-4dd9-97c3-ad1d3328a711/setDeviceName
Content-Type: application/json

{
  "deviceName": "CPC-SALES01"
}

Response

The following example shows the response.

HTTP/1.1 204 No Content