Get deviceLocalCredentialInfo

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.

Retrieve the properties of a deviceLocalCredentialInfo for a specified device object.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) DeviceLocalCredential.ReadBasic.All, DeviceLocalCredential.Read.All
Delegated (personal Microsoft account) Not supported.
Application DeviceLocalCredential.ReadBasic.All, DeviceLocalCredential.Read.All

To access the actual passwords on the device, done by including $select=credentials as part of the query parameters, the app must be assigned the DeviceLocalCredential.Read.All permission and DeviceLocalCredential.ReadBasic.All is insufficient.

For delegated scenarios, the calling user must be a user assigned to one of the following Azure AD roles.

  • Cloud Device Administrator
  • Helpdesk Administrator
  • Intune Service Administrator
  • Security Administrator
  • Security Reader
  • Global Reader

To access the actual passwords on the device, done by including $select=credentials as part of the query parameters, the calling user must be a user assigned to one of the following Azure AD roles.

  • Cloud Device Administrator
  • Intune Service Administrator

HTTP request

To get the device local credential for a specific device object:

GET /deviceLocalCredentials/{deviceId}

Request headers

Name Description
Authorization Bearer {token}. Required.
User-Agent The identifier for the calling application. This value contains information about the operating system and the browser used. Required.
ocp-client-name The name of the client application performing the API call. This header is used for debugging purposes. Optional.
ocp-client-version The version of the client application performing the API call. This header is used for debugging purposes. Optional.

Optional query parameters

This method supports the $select OData query parameter to help customize the response. For general information, see OData query parameters.

Request body

Do not supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and a deviceLocalCredential object in the response body.

Examples

Example 1: Get a device's local adminstrator account credential info

Request

The following is an example of the request. This example does not return the credentials property.

GET https://graph.microsoft.com/beta/deviceLocalCredentials/b465e4e8-e4e8-b465-e8e4-65b4e8e465b4
User-Agent: "Dsreg/10.0 (Windows 10.0.19043.1466)"
ocp-client-name: "My Friendly Client"
ocp-client-version: "1.2"

Response

The following is an example of the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": {
    "@odata.type": "#microsoft.graph.deviceLocalCredentialInfo",
    "id": "b465e4e8-e4e8-b465-e8e4-65b4e8e465b4",
    "deviceName": "LAPS_TEST",
    "lastBackupDateTime": "2023-04-21T13:45:30.0000000Z",
    "refreshDateTime": "2020-05-20T13:45:30.0000000Z"
  }
}

Example 2: Get the device local adminstrator account credential info with the credentials property

Request

The following is an example of the request.

GET https://graph.microsoft.com/beta/deviceLocalCredentials/b465e4e8-e4e8-b465-e8e4-65b4e8e465b4?$select=credentials
User-Agent: "Dsreg/10.0 (Windows 10.0.19043.1466)"
ocp-client-name: "My Friendly Client"
ocp-client-version: "1.2"

Response

The following is an example of the response.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": {
    "@odata.type": "#microsoft.graph.deviceLocalCredentialInfo",
    "id": "b465e4e8-e4e8-b465-e8e4-65b4e8e465b4",
    "deviceName": "LAPS_TEST",
    "lastBackupDateTime": "2023-04-21T13:45:30.0000000Z",
    "refreshDateTime": "2020-05-20T13:45:30.0000000Z",
    "credentials": [
      {
        "accountName": "ContosoLocalAdminAccount",
        "accountSid": "S-1-5-21-2318549658-1590267884-3984890135-1965",
        "backupDateTime": "2023-04-21T13:45:30.0000000Z",
        "passwordBase64": "UQBRAEAAZAA4AGYAOABnAFkA"
      },
      {
        "accountName": "ContosoLocalAdminAccount",
        "accountSid": "S-1-5-21-2318549658-1590267884-3984890135-1965",
        "backupDateTime": "2023-03-22T13:45:30.0000000Z",
        "passwordBase64": "KgBEADkAawBsAGsAZgAjADQA"
      },
      {
        "accountName": "Administrator",
        "accountSid": "S-1-5-21-2318549658-1590267884-3984890135-500",
        "backupDateTime": "2023-02-23T13:45:30.0000000Z",
        "passwordBase64": "TABwAGQAOQAqACgAKQAzADQA"
      }
    ]
  }
}