名前空間: microsoft.graph
新しい attributeSet オブジェクトを作成します。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
CustomSecAttributeDefinition.ReadWrite.All |
注意事項なし。 |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
CustomSecAttributeDefinition.ReadWrite.All |
注意事項なし。 |
重要
職場または学校アカウントを使用した委任されたシナリオでは、サインインしているユーザーに、サポートされているMicrosoft Entraロールまたはサポートされているロールのアクセス許可を持つカスタム ロールを割り当てる必要があります。
属性定義管理者 は、この操作でサポートされる唯一の特権ロールです。
既定では、 グローバル管理者 とその他の管理者ロールには、カスタム セキュリティ属性の読み取り、定義、または割り当てに対するアクセス許可がありません。
HTTP 要求
POST /directory/attributeSets
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、 attributeSet オブジェクトの JSON 表現を指定します。
次の表は、 attributeSet を作成するときに構成できるプロパティを示しています。
プロパティ |
型 |
説明 |
description |
String |
属性セットの説明。 最大 128 文字の長さと Unicode 文字を含めることができます。 後で変更できます。 省略可能。 |
id |
String |
テナント内で一意である属性セットの識別子。 最大 32 文字の長さと Unicode 文字を含めることができます。 スペースまたは特殊文字を含めることはできません。 後で変更することはできません。 大文字と小文字が区別されます。 必須です。 |
maxAttributesPerSet |
Int32 |
この属性セットで定義できるカスタム セキュリティ属性の最大数。 既定値は、null です。 指定しない場合、管理者はテナントごとに最大 500 個のアクティブな属性を追加できます。 後で変更できます。 省略可能。 |
応答
成功した場合、このメソッドは 201 Created
応答コードと、応答本文の attributeSet オブジェクトを返します。
例
要求
次の例では、 という名前 Engineering
の新しい属性セットを追加します。
POST https://graph.microsoft.com/v1.0/directory/attributeSets
Content-Type: application/json
{
"id":"Engineering",
"description":"Attributes for engineering team",
"maxAttributesPerSet":25
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new AttributeSet
{
Id = "Engineering",
Description = "Attributes for engineering team",
MaxAttributesPerSet = 25,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Directory.AttributeSets.PostAsync(requestBody);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
mgc directory attribute-sets create --body '{\
"id":"Engineering",\
"description":"Attributes for engineering team",\
"maxAttributesPerSet":25\
}\
'
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAttributeSet()
id := "Engineering"
requestBody.SetId(&id)
description := "Attributes for engineering team"
requestBody.SetDescription(&description)
maxAttributesPerSet := int32(25)
requestBody.SetMaxAttributesPerSet(&maxAttributesPerSet)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
attributeSets, err := graphClient.Directory().AttributeSets().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AttributeSet attributeSet = new AttributeSet();
attributeSet.setId("Engineering");
attributeSet.setDescription("Attributes for engineering team");
attributeSet.setMaxAttributesPerSet(25);
AttributeSet result = graphClient.directory().attributeSets().post(attributeSet);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const attributeSet = {
id: 'Engineering',
description: 'Attributes for engineering team',
maxAttributesPerSet: 25
};
await client.api('/directory/attributeSets')
.post(attributeSet);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\AttributeSet;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AttributeSet();
$requestBody->setId('Engineering');
$requestBody->setDescription('Attributes for engineering team');
$requestBody->setMaxAttributesPerSet(25);
$result = $graphServiceClient->directory()->attributeSets()->post($requestBody)->wait();
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
Import-Module Microsoft.Graph.Identity.DirectoryManagement
$params = @{
id = "Engineering"
description = "Attributes for engineering team"
maxAttributesPerSet = 25
}
New-MgDirectoryAttributeSet -BodyParameter $params
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.attribute_set import AttributeSet
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AttributeSet(
id = "Engineering",
description = "Attributes for engineering team",
max_attributes_per_set = 25,
)
result = await graph_client.directory.attribute_sets.post(request_body)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
次の例は応答を示しています。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directory/attributeSets/$entity",
"description": "Attributes for engineering team",
"id": "Engineering",
"maxAttributesPerSet": 25
}