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.
Create a new deviceTemplate used to identify attributes and manage a group of devices with similar characteristics.
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)
DeviceTemplate.Create
DeviceTemplate.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
DeviceTemplate.Create
DeviceTemplate.ReadWrite.All
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. The following least privileged roles are supported for this operation:
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.
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".
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new DeviceTemplate
{
MutualTlsOauthConfigurationId = "00001111-aaaa-2222-bbbb-3333cccc4444",
MutualTlsOauthConfigurationTenantId = "00001111-aaaa-2222-bbbb-3333cccc4445",
DeviceAuthority = "Lakeshore Retail",
Manufacturer = "Tailwind Traders",
Model = "DeepFreezerModelAB",
OperatingSystem = "WindowsIoT",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Directory.Templates.DeviceTemplates.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewDeviceTemplate()
mutualTlsOauthConfigurationId := "00001111-aaaa-2222-bbbb-3333cccc4444"
requestBody.SetMutualTlsOauthConfigurationId(&mutualTlsOauthConfigurationId)
mutualTlsOauthConfigurationTenantId := "00001111-aaaa-2222-bbbb-3333cccc4445"
requestBody.SetMutualTlsOauthConfigurationTenantId(&mutualTlsOauthConfigurationTenantId)
deviceAuthority := "Lakeshore Retail"
requestBody.SetDeviceAuthority(&deviceAuthority)
manufacturer := "Tailwind Traders"
requestBody.SetManufacturer(&manufacturer)
model := "DeepFreezerModelAB"
requestBody.SetModel(&model)
operatingSystem := "WindowsIoT"
requestBody.SetOperatingSystem(&operatingSystem)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceTemplates, err := graphClient.Directory().Templates().DeviceTemplates().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DeviceTemplate deviceTemplate = new DeviceTemplate();
deviceTemplate.setMutualTlsOauthConfigurationId("00001111-aaaa-2222-bbbb-3333cccc4444");
deviceTemplate.setMutualTlsOauthConfigurationTenantId("00001111-aaaa-2222-bbbb-3333cccc4445");
deviceTemplate.setDeviceAuthority("Lakeshore Retail");
deviceTemplate.setManufacturer("Tailwind Traders");
deviceTemplate.setModel("DeepFreezerModelAB");
deviceTemplate.setOperatingSystem("WindowsIoT");
DeviceTemplate result = graphClient.directory().templates().deviceTemplates().post(deviceTemplate);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\DeviceTemplate;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceTemplate();
$requestBody->setMutualTlsOauthConfigurationId('00001111-aaaa-2222-bbbb-3333cccc4444');
$requestBody->setMutualTlsOauthConfigurationTenantId('00001111-aaaa-2222-bbbb-3333cccc4445');
$requestBody->setDeviceAuthority('Lakeshore Retail');
$requestBody->setManufacturer('Tailwind Traders');
$requestBody->setModel('DeepFreezerModelAB');
$requestBody->setOperatingSystem('WindowsIoT');
$result = $graphServiceClient->directory()->templates()->deviceTemplates()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.device_template import DeviceTemplate
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DeviceTemplate(
mutual_tls_oauth_configuration_id = "00001111-aaaa-2222-bbbb-3333cccc4444",
mutual_tls_oauth_configuration_tenant_id = "00001111-aaaa-2222-bbbb-3333cccc4445",
device_authority = "Lakeshore Retail",
manufacturer = "Tailwind Traders",
model = "DeepFreezerModelAB",
operating_system = "WindowsIoT",
)
result = await graph_client.directory.templates.device_templates.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new DeviceTemplate
{
MutualTlsOauthConfigurationId = "00001111-aaaa-2222-bbbb-3333cccc4444",
MutualTlsOauthConfigurationTenantId = "00001111-aaaa-2222-bbbb-3333cccc4445",
DeviceAuthority = "Lakeshore Retail",
Manufacturer = "Tailwind Traders",
Model = "DeepFreezerModelAB",
OperatingSystem = "WindowsIoT",
AdditionalData = new Dictionary<string, object>
{
{
"owners@odata.bind" , new List<string>
{
"https://graph.microsoft.com/beta/users/aaaaaaaa-bbbb-cccc-1111-222222222222",
}
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Directory.Templates.DeviceTemplates.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewDeviceTemplate()
mutualTlsOauthConfigurationId := "00001111-aaaa-2222-bbbb-3333cccc4444"
requestBody.SetMutualTlsOauthConfigurationId(&mutualTlsOauthConfigurationId)
mutualTlsOauthConfigurationTenantId := "00001111-aaaa-2222-bbbb-3333cccc4445"
requestBody.SetMutualTlsOauthConfigurationTenantId(&mutualTlsOauthConfigurationTenantId)
deviceAuthority := "Lakeshore Retail"
requestBody.SetDeviceAuthority(&deviceAuthority)
manufacturer := "Tailwind Traders"
requestBody.SetManufacturer(&manufacturer)
model := "DeepFreezerModelAB"
requestBody.SetModel(&model)
operatingSystem := "WindowsIoT"
requestBody.SetOperatingSystem(&operatingSystem)
additionalData := map[string]interface{}{
odataBind := []string {
"https://graph.microsoft.com/beta/users/aaaaaaaa-bbbb-cccc-1111-222222222222",
}
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
deviceTemplates, err := graphClient.Directory().Templates().DeviceTemplates().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DeviceTemplate deviceTemplate = new DeviceTemplate();
deviceTemplate.setMutualTlsOauthConfigurationId("00001111-aaaa-2222-bbbb-3333cccc4444");
deviceTemplate.setMutualTlsOauthConfigurationTenantId("00001111-aaaa-2222-bbbb-3333cccc4445");
deviceTemplate.setDeviceAuthority("Lakeshore Retail");
deviceTemplate.setManufacturer("Tailwind Traders");
deviceTemplate.setModel("DeepFreezerModelAB");
deviceTemplate.setOperatingSystem("WindowsIoT");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
LinkedList<String> ownersOdataBind = new LinkedList<String>();
ownersOdataBind.add("https://graph.microsoft.com/beta/users/aaaaaaaa-bbbb-cccc-1111-222222222222");
additionalData.put("owners@odata.bind", ownersOdataBind);
deviceTemplate.setAdditionalData(additionalData);
DeviceTemplate result = graphClient.directory().templates().deviceTemplates().post(deviceTemplate);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\DeviceTemplate;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeviceTemplate();
$requestBody->setMutualTlsOauthConfigurationId('00001111-aaaa-2222-bbbb-3333cccc4444');
$requestBody->setMutualTlsOauthConfigurationTenantId('00001111-aaaa-2222-bbbb-3333cccc4445');
$requestBody->setDeviceAuthority('Lakeshore Retail');
$requestBody->setManufacturer('Tailwind Traders');
$requestBody->setModel('DeepFreezerModelAB');
$requestBody->setOperatingSystem('WindowsIoT');
$additionalData = [
'owners@odata.bind' => [
'https://graph.microsoft.com/beta/users/aaaaaaaa-bbbb-cccc-1111-222222222222', ],
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->directory()->templates()->deviceTemplates()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.device_template import DeviceTemplate
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DeviceTemplate(
mutual_tls_oauth_configuration_id = "00001111-aaaa-2222-bbbb-3333cccc4444",
mutual_tls_oauth_configuration_tenant_id = "00001111-aaaa-2222-bbbb-3333cccc4445",
device_authority = "Lakeshore Retail",
manufacturer = "Tailwind Traders",
model = "DeepFreezerModelAB",
operating_system = "WindowsIoT",
additional_data = {
"owners@odata_bind" : [
"https://graph.microsoft.com/beta/users/aaaaaaaa-bbbb-cccc-1111-222222222222",
],
}
)
result = await graph_client.directory.templates.device_templates.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.