Skip to content

Latest commit

 

History

History
206 lines (153 loc) · 8.37 KB

File metadata and controls

206 lines (153 loc) · 8.37 KB
title Update device
description Update the properties of a device.
author sandeo-MSFT
ms.localizationpriority medium
ms.subservice entra-directory-management
doc_type apiPageType
ms.date 12/31/2024

Update device

Namespace: microsoft.graph

[!INCLUDE beta-disclaimer]

Update the properties of a device. Only certain properties of a device can be updated through approved Mobile Device Management (MDM) apps.

[!INCLUDE national-cloud-support]

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.

[!INCLUDE permissions-table]

In application-only scenarios and for non-Windows devices, that is, where the operatingSystem property is not Windows, the app can update only the extensionAttributes property.

Important

In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. Intune Administrator is the least privileged role supported for this operation. A calling user in the Cloud Device Administrator role can only enable or disable devices and a user with the Windows 365 Administrator role can only update basic device properties.

HTTP request

You can address the device using either its id or deviceId.

PATCH /devices/{id}
PATCH /devices(deviceId='{deviceId}')

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

In the request body, supply the values for the device properties that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For best performance you shouldn't include existing values that haven't changed.

Property Type Description
accountEnabled Boolean true if the account is enabled; otherwise, false. Only callers with at least the Cloud Device Administrator role can update this property.
alternativeNames String collection List of alternative names for the device, for example, resourceIds.
displayName String The display name for the device.
isCompliant Boolean true if the device complies with Mobile Device Management (MDM) policies; otherwise, false. This can only be updated by Intune for any device OS type or by an approved MDM app for Windows OS devices.
isManaged Boolean true if the device is managed by a Mobile Device Management (MDM) app; otherwise, false. This can only be updated by Intune for any device OS type or by an approved MDM app for Windows OS devices.
operatingSystem String The type of operating system on the device.
operatingSystemVersion String The version of the operating system on the device.

Since the device resource supports extensions, you can use the PATCH operation to add, update, or delete your own app-specific data in custom properties of an extension in an existing device instance.

Response

If successful, this method returns a 204 No Content response code.

Examples

Example 1: Update the accountEnabled property of a device

Request

PATCH https://graph.microsoft.com/beta/devices/7c06cd31-7c30-4f3b-a5c3-444cd8dd63ac
Content-type: application/json

{
  "accountEnabled": false
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

HTTP/1.1 204 No Content

Example 2: Write extensionAttributes on a device

Request

PATCH https://graph.microsoft.com/beta/devices/7c06cd31-7c30-4f3b-a5c3-444cd8dd63ac
Content-type: application/json

{
    "extensionAttributes": {
        "extensionAttribute1": "BYOD-Device"
    }
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

HTTP/1.1 204 No Content

Related content