名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
属性を識別し、同様の特性を持つデバイスのグループを管理するために使用する新しい deviceTemplate を作成します。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
❌ |
❌ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
DeviceTemplate.Create |
DeviceTemplate.ReadWrite.All |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
DeviceTemplate.Create |
DeviceTemplate.ReadWrite.All |
重要
職場または学校アカウントを使用した委任されたシナリオでは、サインインしているユーザーに、サポートされているMicrosoft Entraロールまたはサポートされているロールのアクセス許可を持つカスタム ロールを割り当てる必要があります。 この操作では、次の最小特権ロールがサポートされています。
- クラウド デバイス管理者
- IoT デバイス管理者
- ユーザー - デバイス テンプレート オブジェクトの所有者
HTTP 要求
POST /directory/templates/deviceTemplates
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、 deviceTemplate オブジェクトの JSON 表現を指定します。
deviceTemplate を作成するときに、次のプロパティを指定できます。
プロパティ |
型 |
説明 |
deviceAuthority |
String |
Microsoft Entra テナントでのデバイスのプロビジョニングと管理を担当するパーティのテナント定義名。 たとえば、Tailwind Traders (製造元) は、顧客の建物にインストールされ、Lakeshore Retail (デバイス機関) によって管理されるセキュリティ カメラを作成します。 この値は、デバイス機関 (製造元またはリセラー) によって顧客に提供されます。 必須です。 |
manufacturer |
String |
製造元名。 必須です。 |
model |
String |
モデル名。 必須です。 |
mutualTlsOauthConfigurationId |
String |
mutualTlsOauthConfiguration のオブジェクト ID。 信頼されたルート証明書の代わりに自己署名証明書を使用する場合、この値は必要ありません。 省略可能。 |
mutualTlsOauthConfigurationTenantId |
String |
mutualTlsOauthConfiguration を含むテナントの ID (デバイス機関のテナント ID)。 信頼されたルート証明書の代わりに自己署名証明書を使用する場合、この値は必要ありません。 省略可能。 |
operatingSystem |
String |
オペレーティング システムの種類。 省略可能。 |
owners@odata.bind |
String collection |
所有者がデバイス テンプレートに追加する ID の一覧。 所有者としてサポートされている directoryObject 型は、 サービス プリンシパル、 ユーザー、 またはアプリケーションのみです。 省略可能。 |
応答
成功した場合、このメソッドは応答コード 201 Created
と応答本文に deviceTemplate オブジェクトを返します。 証明書の検証手順中に検証エラーが発生した場合、メソッドは"デバイス証明書を検証できません" というメッセージと共に 400 Bad Request
を返します。
詳細については、「 Microsoft Graph のエラー応答とリソースの種類」を参照してください。
例
例 1: 新しいデバイス テンプレートを作成する
次の例は、新しい deviceTemplate を作成する方法を示しています。
要求
次の例は要求を示しています。
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"
}
// 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);
mgc-beta directory templates device-templates create --body '{\
"mutualTlsOauthConfigurationId": "00001111-aaaa-2222-bbbb-3333cccc4444",\
"mutualTlsOauthConfigurationTenantId": "00001111-aaaa-2222-bbbb-3333cccc4445",\
"deviceAuthority": "Lakeshore Retail",\
"manufacturer": "Tailwind Traders",\
"model": "DeepFreezerModelAB",\
"operatingSystem": "WindowsIoT"\
}\
'
// 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)
// 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);
const options = {
authProvider,
};
const client = Client.init(options);
const deviceTemplate = {
mutualTlsOauthConfigurationId: '00001111-aaaa-2222-bbbb-3333cccc4444',
mutualTlsOauthConfigurationTenantId: '00001111-aaaa-2222-bbbb-3333cccc4445',
deviceAuthority: 'Lakeshore Retail',
manufacturer: 'Tailwind Traders',
model: 'DeepFreezerModelAB',
operatingSystem: 'WindowsIoT'
};
await client.api('/directory/templates/deviceTemplates')
.version('beta')
.post(deviceTemplate);
<?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();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
$params = @{
mutualTlsOauthConfigurationId = "00001111-aaaa-2222-bbbb-3333cccc4444"
mutualTlsOauthConfigurationTenantId = "00001111-aaaa-2222-bbbb-3333cccc4445"
deviceAuthority = "Lakeshore Retail"
manufacturer = "Tailwind Traders"
model = "DeepFreezerModelAB"
operatingSystem = "WindowsIoT"
}
New-MgBetaDirectoryTemplateDeviceTemplate -BodyParameter $params
# 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)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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"
}
例 2: 所有者を使用してデバイス テンプレートを作成する
次の例では、所有者と共に新しい deviceTemplate を作成する方法を示します。
要求
次の例は要求を示しています。
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"
]
}
// 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);
mgc-beta directory templates device-templates create --body '{\
"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"\
]\
}\
'
// 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)
// 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);
const options = {
authProvider,
};
const client = Client.init(options);
const deviceTemplate = {
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'
]
};
await client.api('/directory/templates/deviceTemplates')
.version('beta')
.post(deviceTemplate);
<?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();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
$params = @{
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"
)
}
New-MgBetaDirectoryTemplateDeviceTemplate -BodyParameter $params
# 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)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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"
}