Skip to content

Latest commit

 

History

History
244 lines (189 loc) · 9.95 KB

File metadata and controls

244 lines (189 loc) · 9.95 KB
title Create deviceTemplate
description Create a new deviceTemplate used to identify attributes and manage a group of devices with similar characteristics.
author sofia-geislinger
ms.localizationpriority medium
ms.subservice entra-id
doc_type apiPageType
ms.date 12/31/2024

Create deviceTemplate

Namespace: microsoft.graph

[!INCLUDE beta-disclaimer]

Create a new deviceTemplate used to identify attributes and manage a group of devices with similar characteristics.

[!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]

[!INCLUDE rbac-devicestemplate-apis]

HTTP request

POST /directory/templates/deviceTemplates

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 deviceTemplate object.

You can specify the following properties when you create a deviceTemplate.

Property Type Description
deviceAuthority String A tenant-defined name for the party that's responsible for provisioning and managing devices on the Microsoft Entra tenant. For example, Tailwind Traders (the manufacturer) makes security cameras that are installed in customer buildings and managed by Lakeshore Retail (the device authority). This value is provided to the customer by the device authority (manufacturer or reseller). Required.
manufacturer String Manufacturer name. Required.
model String Model name. Required.
mutualTlsOauthConfigurationId String Object ID of the mutualTlsOauthConfiguration. This value isn't required if self-signed certificates are used instead of trusted root certificates. Optional.
mutualTlsOauthConfigurationTenantId String ID (tenant ID for device authority) of the tenant that contains the mutualTlsOauthConfiguration. This value isn't required if self-signed certificates are used instead of trusted root certificates. Optional.
operatingSystem String Operating system type. Optional.
owners@odata.bind String collection List of IDs for owners to add to the device template. Only the following directoryObject types are supported as owners: service principals, users, or applications. Optional.

Response

If successful, this method returns a 201 Created response code and a deviceTemplate object in the response body. If a validation failure occurs during the certificate validation steps, the method returns a 400 Bad Request along with the message, "Unable to validate device certificate".

For more information, see Microsoft Graph error responses and resource types.

Examples

Example 1: Create a new device template

The following example shows how to create a new deviceTemplate.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/directory/templates/deviceTemplates
Content-Type: application/json
Content-length: 106

{
  "mutualTlsOauthConfigurationId": "00001111-aaaa-2222-bbbb-3333cccc4444",
  "mutualTlsOauthConfigurationTenantId": "00001111-aaaa-2222-bbbb-3333cccc4445",
  "deviceAuthority": "Lakeshore Retail",
  "manufacturer": "Tailwind Traders",
  "model": "DeepFreezerModelAB",
  "operatingSystem": "WindowsIoT"
}

[!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

The following example shows the response.

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

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#directory/templates/deviceTemplates/$entity",
  "id": "c0ff9329-3596-4ece-8aa9-3dd23a925356",
  "mutualTlsOauthConfigurationId": "00001111-aaaa-2222-bbbb-3333cccc4444",
  "mutualTlsOauthConfigurationTenantId": "00001111-aaaa-2222-bbbb-3333cccc4445",
  "deletedDateTime": null,
  "deviceAuthority": "Lakeshore Retail",
  "manufacturer": "Tailwind Traders",
  "model": "DeepFreezerModelAB",
  "operatingSystem": "WindowsIoT"
}

Example 2: Create a device template with an owner

The following example shows how to create a new deviceTemplate with an owner.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/directory/templates/deviceTemplates
Content-Type: application/json
Content-length: 106

{
  "mutualTlsOauthConfigurationId": "00001111-aaaa-2222-bbbb-3333cccc4444",
  "mutualTlsOauthConfigurationTenantId": "00001111-aaaa-2222-bbbb-3333cccc4445",
  "deviceAuthority": "Lakeshore Retail",
  "manufacturer": "Tailwind Traders",
  "model": "DeepFreezerModelAB",
  "operatingSystem": "WindowsIoT",
  "owners@odata.bind": [
    "https://graph.microsoft.com/beta/users/aaaaaaaa-bbbb-cccc-1111-222222222222"
  ]
}

[!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

The following example shows the response.

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

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#directory/templates/deviceTemplates/$entity",
  "id": "c0ff9329-3596-4ece-8aa9-3dd23a925356",
  "mutualTlsOauthConfigurationId": "00001111-aaaa-2222-bbbb-3333cccc4444",
  "mutualTlsOauthConfigurationTenantId": "00001111-aaaa-2222-bbbb-3333cccc4445",
  "deletedDateTime": null,
  "deviceAuthority": "Lakeshore Retail",
  "manufacturer": "Tailwind Traders",
  "model": "DeepFreezerModelAB",
  "operatingSystem": "WindowsIoT"
}