Create customSecurityAttributeDefinition

名前空間: microsoft.graph

重要

Microsoft Graph のバージョンの /beta API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 API が v1.0 で使用できるかどうかを確認するには、 バージョン セレクターを使用します。

新しい customSecurityAttributeDefinition オブジェクトを作成 します。

アクセス許可

この API を呼び出すには、次のいずれかのアクセス許可が必要です。アクセス許可の選択方法などの詳細については、「アクセス許可」を参照してください。

アクセス許可の種類 アクセス許可 (特権の小さいものから大きいものへ)
委任 (職場または学校のアカウント) CustomSecAttributeDefinition.ReadWrite.All
委任 (個人用 Microsoft アカウント) サポートされていません。
アプリケーション CustomSecAttributeDefinition.ReadWrite.All

サインインしているユーザーには、属性定義管理者 ディレクトリ ロールも割り当てる必要があります。 既定では、グローバル管理者と他の管理者ロールには、カスタム セキュリティ属性の読み取り、定義、または割り当て権限はありません。

HTTP 要求

POST /directory/customSecurityAttributeDefinitions

要求ヘッダー

名前 説明
Authorization ベアラー {token}。必須。
Content-Type application/json. Required.

要求本文

要求本文で、 customSecurityAttributeDefinition オブジェクトの JSON 表記を指定 します。

次の表に、 customSecurityAttributeDefinition を作成するときに構成できるプロパティを示します。

プロパティ 種類 説明
attributeSet String 属性セットの名前。 大文字と小文字は区別されません。 必須です。
description String カスタム セキュリティ属性の説明。 最大 128 文字の長く、Unicode 文字を含めることができます。 スペースまたは特殊文字を含めることはできません。 後で変更できます。 オプション。
isCollection Boolean カスタム セキュリティ属性に複数の値を割り当て可能かどうかを示します。 後で変更することはできません。 ブール type 型 (Boolean) に設定されている場合は isCollection 、true に設定できません。 必須です。
isSearchable Boolean 属性の値が割り当てられているオブジェクトを検索する場合に、カスタム セキュリティ属性値にインデックスを作成するかどうかを示します。 後で変更することはできません。 必須です。
name String カスタム セキュリティ属性の名前。 属性セット内で一意である必要があります。 最大 32 文字の長く、Unicode 文字を含めることができます。 スペースまたは特殊文字を含めることはできません。 後で変更することはできません。 大文字と小文字は区別されません。 必須です。
status String カスタム セキュリティ属性がアクティブか非アクティブかを指定します。 受け入れ可能な値は、 Available と です Deprecated。 後で変更できます。 必須。
type String カスタム セキュリティ属性値のデータ型。 サポートされている型は、 BooleanInteger、、 です String。 後で変更することはできません。 必須です。
usePreDefinedValuesOnly Boolean 定義済みの値のみをカスタム セキュリティ属性に割り当て可能かどうかを示します。 false に設定すると、自由形式の値を使用できます。 後で true から false に変更できますが、false から true に変更することはできません。 ブール type 型 (Boolean) に設定されている場合は usePreDefinedValuesOnly 、true に設定できません。 必須です。

プロパティ id は自動生成され、設定できません。

応答

成功した場合、このメソッドは応答 201 Created コードと、応答本文の customSecurityAttributeDefinition オブジェクトを返します。

例 1: カスタム セキュリティ属性を追加する

次の使用例は、String 型の 1 つの自由形式の値である新しいカスタム セキュリティ属性定義を追加します。

  • 属性セット: Engineering
  • 属性: ProjectDate

要求

POST https://graph.microsoft.com/beta/directory/customSecurityAttributeDefinitions
Content-Type: application/json

{
    "attributeSet":"Engineering",
    "description":"Target completion date",
    "isCollection":false,
    "isSearchable":true,
    "name":"ProjectDate",
    "status":"Available",
    "type":"String",
    "usePreDefinedValuesOnly": false
}

応答

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

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#directory/customSecurityAttributeDefinitions/$entity",
    "attributeSet": "Engineering",
    "description": "Target completion date",
    "id": "Engineering_ProjectDate",
    "isCollection": false,
    "isSearchable": true,
    "name": "ProjectDate",
    "status": "Available",
    "type": "String",
    "usePreDefinedValuesOnly": false
}

例 2: 複数の定義済み値をサポートするカスタム セキュリティ属性を追加する

次の使用例は、定義済みの String 型の複数の値をサポートする新しいカスタム セキュリティ属性定義を追加します。

  • 属性セット: Engineering
  • 属性: Project

要求

POST https://graph.microsoft.com/beta/directory/customSecurityAttributeDefinitions
Content-Type: application/json
Content-length: 310

{
    "attributeSet":"Engineering",
    "description":"Active projects for user",
    "isCollection":true,
    "isSearchable":true,
    "name":"Project",
    "status":"Available",
    "type":"String",
    "usePreDefinedValuesOnly": true
}

応答

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

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#directory/customSecurityAttributeDefinitions/$entity",
    "attributeSet": "Engineering",
    "description": "Active projects for user",
    "id": "Engineering_Project",
    "isCollection": true,
    "isSearchable": true,
    "name": "Project",
    "status": "Available",
    "type": "String",
    "usePreDefinedValuesOnly": true
}

例 3: 定義済みの値のリストを持つカスタム セキュリティ属性を追加する

次の使用例は、文字列のコレクションとして定義済みの値の一覧を持つ新しいカスタム セキュリティ属性定義を追加します。

  • 属性セット: Engineering
  • 属性: Project
  • 属性データ型: 文字列のコレクション
  • 定義済みの値: Alpine、 、 Baker``Cascade

要求

POST https://graph.microsoft.com/beta/directory/customSecurityAttributeDefinitions
Content-Type: application/json

{
    "attributeSet": "Engineering",
    "description": "Active projects for user",
    "isCollection": true,
    "isSearchable": true,
    "name": "Project",
    "status": "Available",
    "type": "String",
    "usePreDefinedValuesOnly": true,
    "allowedValues": [
        {
            "id": "Alpine",
            "isActive": true
        },
        {
            "id": "Baker",
            "isActive": true
        },
        {
            "id": "Cascade",
            "isActive": true
        }
    ]
}

応答

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

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#directory/customSecurityAttributeDefinitions/$entity",
    "attributeSet": "Engineering",
    "description": "Active projects for user",
    "id": "Engineering_Project",
    "isCollection": true,
    "isSearchable": true,
    "name": "Project",
    "status": "Available",
    "type": "String",
    "usePreDefinedValuesOnly": true
}