関数とアクション |Graph API リファレンス

適用対象: Graph API | Azure Active Directory

このトピックでは、Azure AD Graph API で公開される関数とアクションおよびその呼び出し方法について説明します。

Graph API は、ユーザー、グループ、組織の連絡先、アプリケーションなど、Azure Active Directory のディレクトリ オブジェクトへのプログラムによるアクセスを提供する OData 3.0 対応 REST API です。

重要

Azure AD Graph API の機能は、統合 API の Microsoft Graph からも使用できます。Microsoft Graph には、Outlook、OneDrive、OneNote、Planner、Office Grap など他の Microsoft サービスの API も含まれており、これらはすべて単一のアクセス トークンを使用して単一のエンドポイントからアクセスします。

Graph API を使用してアクションと関数を呼び出す

Graph API でアクションまたは関数を呼び出すには、適切なエンドポイントに POST 要求を送信します。

Graph API の要求では、次の基本 URL を使用します。

https://graph.windows.net/{tenant_id}/{resource_path}?{api_version}[odata_query_parameters]

重要

Graph API に送信する要求は、適切な形式で指定し、Graph API の有効なエンドポイントおよびバージョンを対象として、Azure AD から取得された有効なアクセス トークンを Authorization ヘッダーに含める必要があります。 Graph API での要求の作成および応答の受信の詳細については、「Operations Overview」を参照してください。

ディレクトリ サービス自体で呼び出される関数またはアクションにはリソース パスは必要ありません。 特定のリソースで呼び出される関数または操作の場合は、対象となるリソースに応じて異なる方法で {resource_path} を指定します。 リソース パスに含まれる各部の意味を以下に示します。

  • (resource_collection} では、ユーザー、連絡先、グループなどのリソース コレクションを指定します。
  • {resource_id} は、リソース コレクション内の対象となる特定のリソースを識別します。 通常はオブジェクト ID (GUID) ですが、ユーザーの場合は、ユーザー プリンシパル名 (UPN) を使用することもできます。

me エイリアスを使用すると、サインインしているユーザーを対象にすることができます。 このエイリアスで、{tenant_id}/users/{user_id} という URL パス セグメントを置き換えます。 このエイリアスを使用すると、Graph API は要求にアタッチされているベアラー トークンからユーザーとテナントを取得します。

たとえば、次の POST 要求を使用して、サインインしているユーザーにライセンスを割り当てることができます (適切な要求本文を含める必要もあります)。

POST https://graph.windows.net/me/assignLicense?api-version=1.6

me エイリアスを使用する操作の実行の詳細については、「REST operations on the signed-in user (サインインしているユーザーに対する REST 操作)」を参照してください。

関数

ディレクトリでの関数による副作用はありません。 つまり、関数を呼び出しても、データが返されるだけで、ディレクトリ内のどのデータも変更されることはありません。 次のトピックでは、Graph API で関数を呼び出す方法を説明します。


checkMemberGroups: グループ リストでのメンバーシップの確認

グループ リストでユーザー、連絡先、グループ、またはサービス プリンシパルのメンバーシップを確認するには、checkMemberGroups 関数を呼び出します。 この操作は推移的です。

要求ごとに最大 20 グループまで確認することができます。

{
    "api":  "Functions",
    "operation":    "checkMemberGroups" 
}

要求本文

プロパティ名 必須項目です。 説明
isSyncedFromOnPremises Collection(Edm.String) メンバーシップを確認するグループのオブジェクト ID を含むコレクション。 最大 20 グループを指定できます。

応答本文

プロパティ名 説明
value Collection(Edm.String) 要求で指定されたグループのうち、連絡先、ユーザー、グループ、またはサービス プリンシパルがメンバーであるグループのオブジェクト ID が格納されているコレクション。

getAvailableExtensionProperties: ディレクトリに登録されている拡張プロパティの取得

ディレクトリに登録されている拡張プロパティをすべて、または拡張プロパティのフィルター処理されたリストを返すには、getAvailableExtensionProperties 関数を呼び出します。 拡張プロパティは、UserGroupTenantDetailDeviceApplication、および ServicePrincipal というエンティティでサポートされます。 ディレクトリで拡張プロパティを登録および登録解除する方法、および拡張プロパティの値を変更する方法の詳細については、「Directory Schema Extensions」を参照してください。

重要: バージョン 1.5 以降が必要です。

{
    "api":  "Functions",
    "operation":    "getAvailableExtensionProperties" 
}

要求本文

プロパティ名 必須項目です。 説明
isSyncedFromOnPremises Edm.Boolean × オンプレミス ディレクトリから同期されている拡張プロパティのみが返されるように指定する場合は true、オンプレミス ディレクトリから同期されていない拡張プロパティのみが返されるようにシテイルする場合は false です。 このパラメーターを指定しないと、すべての拡張プロパティ (同期されているものとされていないものの両方) が返されます。

応答本文

プロパティ名 説明
value Collection(ExtensionProperty) ディレクトリに登録されている拡張プロパティのうち、要求に従ってフィルター処理されたものを含むコレクション。

getMemberGroups: グループ メンバーシップの取得 (推移的)

ユーザー、連絡先、グループ、またはサービス プリンシパルがメンバーになっているグループを取得するには、それらに対して getMemberGroups 関数を呼び出します。 この関数は推移的です。

: 返されるグループの最大数は 2046 です。 対象オブジェクトに 2046 個を超えるグループの直接または推移的メンバーシップがある場合、関数は HTTP エラー応答を返し、Directory_ResultSizeLimitExceeded というエラー コードが示されます。

{
    "api":  "Functions",
    "operation":    "getMemberGroups",
}

要求本文

プロパティ名 必須項目です。 説明
securityEnabledOnly Edm.Boolean エンティティがメンバーであるセキュリティ グループのみが返されるように指定する場合は true、エンティティがメンバーであるすべてのグループが返されるように指定する場合は false です。 : パラメーターが true の場合、関数を呼び出すことができるのはユーザーに対してのみです。

応答本文

プロパティ名 説明
value Collection(Edm.String) 連絡先、ユーザー、グループ、またはサービス プリンシパルがメンバーであるグループのオブジェクト ID が格納されているコレクション。

getMemberObjects: グループおよびディレクトリ ロール メンバーシップの取得 (推移的)

ユーザー、連絡先、グループ、またはサービス プリンシパルがメンバーになっているグループおよびディレクトリ ロールを取得するには、それらに対して getMemberObjects 関数を呼び出します。 この関数は推移的です。

: 返されるグループおよびディレクトリ ロールの最大数は 2046 です。 対象オブジェクトに 2046 個を超えるグループおよびディレクトリ ロールの直接または推移的メンバーシップがある場合、関数は HTTP エラー応答を返し、Directory_ResultSizeLimitExceeded というエラー コードが示されます。

重要: バージョン 1.5 以降が必要です。

{
    "api":  "Functions",
    "operation":    "getMemberObjects" 
}

要求本文

プロパティ名 必須項目です。 説明
securityEnabledOnly Edm.Boolean エンティティがメンバーであるセキュリティ グループのみが返されるように指定する場合は true、エンティティがメンバーであるすべてのグループおよびディレクトリ ロールが返されるように指定する場合は false です。 : パラメーターが true の場合、関数を呼び出すことができるのはユーザーに対してのみです。

応答本文

プロパティ名 説明
value Collection(Edm.String) 連絡先、ユーザー、グループ、またはサービス プリンシパルがメンバーであるグループおよびディレクトリ ロールのオブジェクト ID が格納されているコレクション。

getObjectsByObjectIds: オブジェクト ID リストからのオブジェクトの取得

ディレクトリ サービスで getObjectsByObjectIds 関数を呼び出し、オブジェクト ID リストで指定されているディレクトリ オブジェクトを返します。 オプションの types パラメーターを指定して、どのリソース コレクション (ユーザーやグループなど) を検索するかを指定することもできます。

この関数の一般的な使用目的の例は、次のとおりです。

  • getMemberObjects または getMemberGroups のようなオブジェクト ID のコレクションを返す関数によって返されるオブジェクト ID を基になるディレクトリ オブジェクトに解決すること。
  • アプリケーションにより外部ストアに保存されるオブジェクト ID を基になるディレクトリ オブジェクトに解決すること。

重要: バージョン 1.5 以降が必要です。

{
    "api":  "Functions",
    "operation":    "getObjectsByObjectIds" 
}

要求本文

プロパティ名 必須項目です。 説明
objectIds Collection(Edm.String) オブジェクトを返すオブジェクト ID のコレクション。 最大 1,000 個のオブジェクト ID を指定できます。
種類 Collection(Edm.String) × 検索するリソース コレクションのセット (エンティティ セット) を指定するオブジェクトの種類のコレクション。 指定しない場合、既定値は DirectoryObject です。これにはディレクトリのすべてのオブジェクトが含まれます。 DirectoryObject から派生するオブジェクト (UserGroupServicePrincipal など) をコレクションに指定できます。 これらの値では大文字と小文字が区別されません。

応答本文

プロパティ名 説明
value Collection(DirectoryObject) 指定したオブジェクト ID とリソース コレクションに見つかったオブジェクトのコレクション。

isMemberOf: 特定のグループ内のメンバシップの確認 (推移的)

特定のユーザー、グループ、連絡先、またはサービス プリンシパルが指定したグループのメンバーかどうかを確認するには、ディレクトリ サービスで IsMemberOf 関数を呼び出します。 この操作は推移的です。

{
    "api":  "Functions",
    "operation":    "isMemberOf" 
}

要求本文

プロパティ名 必須項目です。 説明
groupId Edm.String 確認するグループのオブジェクト ID。
memberId Edm.String 指定したグループでのメンバーシップを確認する連絡先、グループ、ユーザー、またはサービス プリンシパルのオブジェクト ID。

応答本文

プロパティ名 説明
value Edm.Boolean 指定したユーザー、グループ、連絡先、またはサービス プリンシパルに指定したグループの直接または推移的メンバーシップがある場合は true、それ以外の場合は false です。

アクション

ディレクトリでのアクションによる副作用があります。 つまり、アクションを呼び出すときに、ディレクトリ内のデータが変更される可能性があります。 たとえば、ユーザーにライセンスが割り当てられたり、以前に削除したアプリケーションが復元されたりする場合があります。

assignLicense: ユーザーに対するライセンスの追加または削除

ユーザーのサブスクリプションを追加または削除するには、ユーザーに対して assignLicense アクションを呼び出します。 サブスクリプションに関連付けられている特定のプランを有効および無効にすることもできます。

重要: バージョン 2013-11-08 以降が必要です。

{
    "api":  "Functions",
    "operation":    "assignLicense" 
}

要求本文

プロパティ名 必須項目です。 説明
addLicenses Collection([AssinedPlan]) 追加するライセンスを指定する AssignedLicense オブジェクトのコレクション。 AssignedLicense オブジェクトで disabledPlans プロパティを設定することで、ライセンスに関連付けられているプランを無効にできます。
removeLicenses Collection(Edm.Guid) 削除するライセンスを示す GUID のコレクション。

: サブスクリプションの SKU ID およびプラン ID は、テナント オブジェクトから読み取ることができます。 たとえば、https://graph.windows.net/myorganization/subscribedSkus に対して GET 要求を実行すると、サインインしているユーザーのテナントで使用可能なサブスクリプションが返されます。 これらは SubscribedSku エンティティとして返され、SKU ID は skuId プロパティから読み取ることができます。 サブスクリプションに関連付けられているプラン ID は、servicePlans コレクションから取得できます。 サブスクリプションを使用できるかどうかは、consumedUnits プロパティおよび prepaidUnits プロパティ ("有効"、"一時停止"、"警告" の各状態になっているユニットの数を含む) の値から計算できます。

その他の例

この要求では、Enterprise Office SKU の初期ライセンス割り当てを示します。これには、SharePoint Online、Lync Online、および Exchange Online の各サービス プランが含まれます。

POST https://graph.windows.net/myorganization/users/alexd@a830edad9050849NDA1.onmicrosoft.com/assignLicense?api-version=1.5 HTTP/1.1
Authorization: Bearer eyJ0eX ... FWSXfwtQ
Content-Type: application/json
Host: graph.windows.net
Content-Length: 35

{
  "addLicenses":[{"disabledPlans":[ ],"skuId":"6fd2c87f-b296-42f0-b197-1e91e994b900"}],
  "removeLicenses":[ ]
}

この要求は、ユーザーのライセンスを更新して特定のプランを無効にします。 この例では、2 つの disabledPlans (SharePointOnline と LyncOnline) があり、Exchange サービス プランのみが有効のままになります。

POST https://graph.windows.net/myorganization/users/alexd@a830edad9050849NDA1.onmicrosoft.com/assignLicense?api-version=1.5 HTTP/1.1
Authorization: Bearer eyJ0eX ... FWSXfwtQ
Content-Type: application/json
Host: graph.windows.net
Content-Length: 35

{ 
  "addLicenses":[  { "disabledPlans":  [”5dbe027f-2339-4123-9542-606e4d348a72”,
                                        “0feaeb32-d00e-4d66-bd5a-43b5b83db82c” ], 

                      "skuId":"6fd2c87f-b296-42f0-b197-1e91e994b900"
                   }  

                 ],
   "removeLicenses":[ ]

 }

この最後の要求では、ユーザーからライセンスを削除する方法を示します。

POST https://graph.windows.net/myorganization/users/alexd@a830edad9050849NDA1.onmicrosoft.com/assignLicense?api-version=1.5 HTTP/1.1
Authorization: Bearer eyJ0eX ... FWSXfwtQ
Content-Type: application/json
Host: graph.windows.net
Content-Length: 35

{
  "addLicenses":[ ],

  "removeLicenses":["6fd2c87f-b296-42f0-b197-1e91e994b900"]
}

changePassword: サインインしているユーザーのパスワードの変更

サインインしているユーザーに対して changePassword アクションを呼び出し、ユーザー独自のパスワードを変更します。

: このアクションは、サインインしているユーザーに対してのみ呼び出すことができます。 下記のように me エイリアスを使用する操作のアドレス指定だけでなく、/users/<objectId>/changePassword または /users/userPrincipalName/changePassword を使用することができますが、これらのアドレス指定モードを使用する場合、対象ユーザーはサインインしているユーザーである必要があります。

重要: バージョン 1.6 以降が必要です。

{
    "api":  "MeOps",
    "operation":    "changePassword" 
}

要求本文

プロパティ名 必須項目です。 説明
currentPassword Edm.String サインインしているユーザーの現在のパスワード。
newPassword Edm.String 新しいパスワード。

応答本文

ありません。


restore: 削除されたアプリケーションの復元

削除されたアプリケーションに対して復元アクションを呼び出して、ディレクトリに復元します。

: 削除されたアプリケーションは、deletedApplications リソース コレクションを読み取ることで見つけることができます。 たとえば、https://graph.windows.net/myorganization/deletedApplications?api-version=1.5 という URL に GET を実行すると、組織にに関連付けられている削除されたアプリケーションが返されます。

重要: バージョン 1.5 以降が必要です。

{
    "api":  "Functions",
    "operation":    "restore" 
}

要求本文

プロパティ名 必須項目です。 説明
identifierUris Collection(Edm.String) × アプリケーションの識別子 URI のコレクション。 これらは、復元されたApplicationidentifierUris プロパティに設定されます。 パラメーターを省略すると、identifierUris プロパティはその元の値を保持します。

応答本文

説明
[アプリケーション] 復元されたアプリケーション。

verify: ドメインの所有者の確認 (プレビュー)

ドメインに対して確認アクションを呼び出して、ドメインの所有者を確認します。

重要: 未確認のドメイン ([Domain] の isVerified プロパティが false である) にのみ適用されます。 ベータ版でのみサポートされます。

{
    "api":  "Functions",
    "operation":    "verify" 
}

要求本文

ありません。

応答本文

説明
[Domain] 確認対象のドメイン。 IsVerified プロパティは、ドメインの所有権が正常に確認されたかどうかを示します。

applications: Get application properties by object ID

GET https://graph.windows.net/myorganization/applications/{application_oid}?api-version

Parameters

ParameterTypeValueNotes
URL
application_oidstring

00009987-f6d8-4957-a6ca-7848d986ffff

The object id of the application.
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
GET https://graph.windows.net/myorganization/applications/00009987-f6d8-4957-a6ca-7848d986ffff?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#Collection(Microsoft.DirectoryServices.directoryObjects/@Element)",
  "odata.type": "Microsoft.DirectoryServices.Application",
  "objectType": "Application",
  "objectId": "35418b3b-476c-4271-81a8-6db65d397ff4",
  "deletionTimestamp": null,
  "addIns": [],
  "allowActAsForAllClients": null,
  "appBranding": null,
  "appCategory": null,
  "appData": null,
  "appId": "1062a13d-f7e5-4ea7-8d24-427f6ff1e5e1",
  "appMetadata": {
    "version": 0,
    "data": [
      {
        "key": "ApplicationMetadata",
        "value": "eyJBcHBsaWNhd..."
      }
    ]
  },
  "appRoles": [],
  "availableToOtherTenants": true,
  "displayName": "Test App",
  "encryptedMsiApplicationSecret": null,
  "errorUrl": null,
  "groupMembershipClaims": "None",
  "homepage": null,
  "identifierUris": [],
  "keyCredentials": [
    {
      "customKeyIdentifier": "pZMUkCG+igju29A1o/BYhnWffff=",
      "endDate": "2017-10-11T07:00:00Z",
      "keyId": "dceb697c-477a-4a25-be87-38282995ffff",
      "startDate": "2012-09-11T07:00:00Z",
      "type": "AsymmetricX509Cert",
      "usage": "Verify",
      "value": null
    },
    {
      "customKeyIdentifier": "pEFcLQgJrxgCgQwBbtV/G5Cffff=",
      "endDate": "2017-06-19T07:00:00Z",
      "keyId": "fed7d654-4ae7-4a53-bd60-71dc7eb0ffff",
      "startDate": "2012-05-19T07:00:00Z",
      "type": "AsymmetricX509Cert",
      "usage": "Verify",
      "value": null
    }
  ],
  "knownClientApplications": [],
  "logoUrl": null,
  "logoutUrl": null,
  "oauth2AllowImplicitFlow": false,
  "oauth2AllowUrlPathMatching": false,
  "oauth2Permissions": [],
  "oauth2RequirePostResponse": false,
  "passwordCredentials": [],
  "publicClient": false,
  "recordConsentConditions": null,
  "replyUrls": [],
  "requiredResourceAccess": [],
  "samlMetadataUrl": null,
  "supportsConvergence": false,
  "tokenEncryptionKeyId": null
}

applicationsByAppId: Get application properties by application ID

GET https://graph.windows.net/myorganization/applicationsByAppId/{application_id}?api-version

Parameters

ParameterTypeValueNotes
URL
application_idstring

1062a13d-f7e5-4ea7-8d24-427f6ff1e5e1

The application ID (GUID) of the application.
Query
api-versionstring

1.6

The version of the Graph API to target. Required.
GET https://graph.windows.net/myorganization/applicationsByAppId/1062a13d-f7e5-4ea7-8d24-427f6ff1e5e1?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#directoryObjects/Microsoft.DirectoryServices.Application/@Element",
  "odata.type": "Microsoft.DirectoryServices.Application",
  "objectType": "Application",
  "objectId": "35418b3b-476c-4271-81a8-6db65d397ff4",
  "deletionTimestamp": null,
  "addIns": [],
  "allowActAsForAllClients": null,
  "appBranding": null,
  "appCategory": null,
  "appData": null,
  "appId": "1062a13d-f7e5-4ea7-8d24-427f6ff1e5e1",
  "appMetadata": {
    "version": 0,
    "data": [
      {
        "key": "ApplicationMetadata",
        "value": "eyJBcHBsaWNhd..."
      }
    ]
  },
  "appRoles": [],
  "availableToOtherTenants": true,
  "displayName": "Test App",
  "encryptedMsiApplicationSecret": null,
  "errorUrl": null,
  "groupMembershipClaims": "None",
  "homepage": null,
  "identifierUris": [],
  "keyCredentials": [
    {
      "customKeyIdentifier": "pZMUkCG+igju29A1o/BYhnWffff=",
      "endDate": "2017-10-11T07:00:00Z",
      "keyId": "dceb697c-477a-4a25-be87-38282995ffff",
      "startDate": "2012-09-11T07:00:00Z",
      "type": "AsymmetricX509Cert",
      "usage": "Verify",
      "value": null
    },
    {
      "customKeyIdentifier": "pEFcLQgJrxgCgQwBbtV/G5Cffff=",
      "endDate": "2017-06-19T07:00:00Z",
      "keyId": "fed7d654-4ae7-4a53-bd60-71dc7eb0ffff",
      "startDate": "2012-05-19T07:00:00Z",
      "type": "AsymmetricX509Cert",
      "usage": "Verify",
      "value": null
    }
  ],
  "knownClientApplications": [],
  "logoUrl": null,
  "logoutUrl": null,
  "oauth2AllowImplicitFlow": false,
  "oauth2AllowUrlPathMatching": false,
  "oauth2Permissions": [],
  "oauth2RequirePostResponse": false,
  "passwordCredentials": [],
  "publicClient": false,
  "recordConsentConditions": null,
  "replyUrls": [],
  "requiredResourceAccess": [],
  "samlMetadataUrl": null,
  "supportsConvergence": false,
  "tokenEncryptionKeyId": null
}

Response List

Status CodeDescription
200OK. Indicates success. Returns the application object ID.

checkMemberGroups: Check for membership in a list of groups

POST https://graph.windows.net/myorganization/{resource_collection}/{resource_id}/checkMemberGroups?api-version

Parameters

ParameterTypeValueNotes
URL
resource_collectionstring

users

Specifies the resource collection to target. Acceptable values are users, groups, contacts, and servicePrincipals.
resource_idstring

alexd@a830edad9050849NDA1.onmicrosoft.com

Specifies the user, contact, group, or service principal for which membership is to be checked. For contacts, groups, and service principals the entity-identifier should be an object ID (GUID); for users, it can be either the object ID or the user principal name (UPN)..
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "groupIds": [
    "8ab3f116-1afb-44cb-8e61-6b20cb1e353c",
    "be78b7e2-a94a-4ab0-9bb4-403977cc7ec6",
    "cf61b8c9-3626-4fe4-b2f7-ac31fa905605"
  ]
}
POST https://graph.windows.net/myorganization/users/alexd%40a830edad9050849NDA1.onmicrosoft.com/checkMemberGroups?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#Collection(Edm.String)",
  "value": [
    "8ab3f116-1afb-44cb-8e61-6b20cb1e353c",
    "be78b7e2-a94a-4ab0-9bb4-403977cc7ec6"
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. The object IDs of the groups in the request that the target user, contact, group, or service principal has either direct or transitive membership in are returned.

getAvailableExtensionProperties: Get the registered extension properties in a directory

POST https://graph.windows.net/myorganization/getAvailableExtensionProperties?api-version

Parameters

ParameterTypeValueNotes
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "isSyncedFromOnPremises": false
}

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#directoryObjects",
  "value": [
    {
      "odata.type": "Microsoft.DirectoryServices.ExtensionProperty",
      "objectType": "ExtensionProperty",
      "objectId": "d6a8bfec-893d-46e4-88fd-7db5fcc0fa62",
      "deletionTimestamp": null,
      "appDisplayName": "SampleApp",
      "name": "extension_4d405aa8baa04fb494d3e0571fd9fd71_skypeId",
      "dataType": "String",
      "isSyncedFromOnPremises": false,
      "targetObjects": [
        "User"
      ]
    }
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. A collection that contains the extension properties is returned.

getMemberGroups: Get group memberships (transitive)

POST https://graph.windows.net/myorganization/{resource_collection}/{resource_id}/getMemberGroups?api-version

Parameters

ParameterTypeValueNotes
URL
resource_collectionstring

users

Specifies the resource collection to target. Acceptable values are users, groups, contacts, and servicePrincipals.
resource_idstring

alexd@a830edad9050849NDA1.onmicrosoft.com

Specifies the user, contact, group, or service principal for which group memberships are to be returned. For contacts, groups, and service principals the entity-identifier should be an object ID (GUID); for users, it can be either the object ID or the user principal name (UPN)..
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "securityEnabledOnly": false
}
POST  https://graph.windows.net/myorganization/users/alexd%40a830edad9050849NDA1.onmicrosoft.com/getMemberGroups?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#Collection(Edm.String)",
  "value": [
    "8ab3f116-1afb-44cb-8e61-6b20cb1e353c",
    "be78b7e2-a94a-4ab0-9bb4-403977cc7ec6",
    "5e624f44-d38d-4943-b07c-2bad078f52ff"
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. The object IDs of the groups that the target user, contact, group, or service principal has either direct or transitive membership in are returned.

getMemberObjects: Get group and directory role memberships (transitive)

POST https://graph.windows.net/myorganization/{resource_collection}/{resource_id}/getMemberObjects?api-version

Parameters

ParameterTypeValueNotes
URL
resource_collectionstring

users

Specifies the resource collection to target. Acceptable values are users, groups, contacts, and servicePrincipals.
resource_idstring

alexd@a830edad9050849NDA1.onmicrosoft.com

Specifies the user, contact, group, or service principal for which group and directory role memberships are to be returned. For contacts, groups, and service principals the entity-identifier should be an object ID (GUID); for users, it can be either the object ID or the user principal name (UPN)..
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "securityEnabledOnly": false
}
POST https://graph.windows.net/myorganization/users/alexd%40a830edad9050849NDA1.onmicrosoft.com/getMemberObjects?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myortanization/$metadata#Collection(Edm.String)",
  "value": [
    "8ab3f116-1afb-44cb-8e61-6b20cb1e353c",
    "be78b7e2-a94a-4ab0-9bb4-403977cc7ec6",
    "5e624f44-d38d-4943-b07c-2bad078f52ff"
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. The object IDs of the groups and directory roles that the target user, contact, group, or service principal has either direct or transitive membership in are returned.

getObjectsByObjectIds: Get objects from a list of object IDs

POST https://graph.windows.net/myorganization/getObjectsByObjectIds?api-version

Parameters

ParameterTypeValueNotes
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "objectIds": [
    "c57cdc98-0dcd-4f90-a82f-c911b288bab9",
    "cc9869f0-6ac0-4d00-bc24-621a2d949d35",
    "477c2fe9-b0e7-4661-8564-ba170666f058",
    "beb9a3bb-2fff-4d5f-99d8-0ce169e8bed7"
  ],
  "types": [
    "group"
  ]
}

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#directoryObjects",
  "value": [
    {
      "odata.type": "Microsoft.DirectoryServices.Group",
      "objectType": "Group",
      "objectId": "c57cdc98-0dcd-4f90-a82f-c911b288bab9",
      "deletionTimestamp": null,
      "description": "Marketing Group",
      "dirSyncEnabled": null,
      "displayName": "Marketing",
      "lastDirSyncTime": null,
      "mail": null,
      "mailNickname": "cdf76b17-0734-41bc-9c24-9a7af93f3502",
      "mailEnabled": false,
      "onPremisesSecurityIdentifier": null,
      "provisioningErrors": [],
      "proxyAddresses": [],
      "securityEnabled": true
    },
    {
      "odata.type": "Microsoft.DirectoryServices.Group",
      "objectType": "Group",
      "objectId": "cc9869f0-6ac0-4d00-bc24-621a2d949d35",
      "deletionTimestamp": null,
      "description": "Engineering Group",
      "dirSyncEnabled": null,
      "displayName": "Engineering",
      "lastDirSyncTime": null,
      "mail": null,
      "mailNickname": "ef3b8cc1-721b-4452-9e30-9867d1de80ea",
      "mailEnabled": false,
      "onPremisesSecurityIdentifier": null,
      "provisioningErrors": [],
      "proxyAddresses": [],
      "securityEnabled": true
    }
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. A collection that contains the directory objects that match the search criterea is returned.

isMemberOf: Check membership in a specific group (transitive)

POST https://graph.windows.net/myorganization/isMemberOf?api-version

Parameters

ParameterTypeValueNotes
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "groupId": "5e624f44-d38d-4943-b07c-2bad078f52ff",
  "memberId": "ea59e4d3-a7a1-4b5b-b65f-a25fcc0c0f99"
}

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#Edm.Boolean",
  "value": true
}

Response List

Status CodeDescription
200OK. Indicates success. Returns true if the user, contact, group, or service principal is a member of the specified group; otherwsie, false.

servicePrincipalsByAppId: Get service principal object ID by application ID

GET https://graph.windows.net/myorganization/servicePrincipalsByAppId/{application_id}/objectId?api-version

Parameters

ParameterTypeValueNotes
URL
application_idstring

1062a13d-f7e5-4ea7-8d24-427f6ff1e5e1

The application ID (GUID) of the service principal.
Query
api-versionstring

1.6

The version of the Graph API to target. Required.
GET https://graph.windows.net/myorganization/servicePrincipalsByAppId/1062a13d-f7e5-4ea7-8d24-427f6ff1e5e1/objectId?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#Edm.String",
  "value": [
    "00b4e797-7017-4720-b187-b01981c820d6"
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. Returns the service principal object ID of the specified application ID.

verify: Verify ownership of a domain

POST https://graph.windows.net/myorganization/domains({domain_name})/verify?api-version

Parameters

ParameterTypeValueNotes
URL
domain_namestring

contoso.com

The fully qualified domain name of the target domain. Must be enclosed in single quotes.
Query
api-versionstring

1.6

The version of the Graph API to target. Required.
POST https://graph.windows.net/myorganization/domains(contoso.com)/verify?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#domains/@Element",
  "authenticationType": "Managed",
  "availabilityStatus": "AvailableImmediately",
  "isAdminManaged": true,
  "isDefault": false,
  "isInitial": false,
  "isRoot": true,
  "isVerified": true,
  "name": "contoso.com",
  "supportedServices": []
}

Response List

Status CodeDescription
200OK. Indicates success. Returns the Domain object. The isVerified property indicates whether the ownership of the domain has been verified successfully.

addKey: Add a KeyCredential for an application

POST https://graph.windows.net/myorganization/applications/{application_oid}/addKey?api-version

Parameters

ParameterTypeValueNotes
URL
application_oidstring

00009987-f6d8-4957-a6ca-7848d986ffff

The object id of the application.
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "keyCredential": {
    "customKeyIdentifier": "6uv7gh",
    "endDate": "endDate=2017-10-11T07:00:00Z",
    "keyId": "633b1614-b669-47c5-961e-f4a45978ffff",
    "type": "AsymmetricX509Cert",
    "usage": "Verify",
    "value": null
  },
  "passwordCredential": null,
  "proof": "Bearer eyJ0eXAiOiJKv1..."
}
POST 
https://graph.windows.net/myorganization/applications/00009987-f6d8-4957-a6ca-7848d986ffff/addKey?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#Collection(Microsoft.DirectoryServices.KeyCredential)",
  "value": [
    {
      "keyCredential": {
        "customKeyIdentifier": "6uv7gh",
        "type": "AsymmetricX509Cert",
        "usage": "Verify",
        "value": "MIZB9jVCACfEw="
      },
      "passwordCredential": null,
      "proof": "eyJ0eXAiOiJKv1"
    }
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. Returns the application's new key credential and password credential directory object.
POST https://graph.windows.net/myorganization/applicationsByAppId/{application_id}/addKey?api-version

Parameters

ParameterTypeValueNotes
URL
application_idstring

1062a13d-f7e5-4ea7-8d24-427f6ff1e5e1

The application ID (GUID) of the application.
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "keyCredential": {
    "customKeyIdentifier": "6uv7gh",
    "type": "X509CertAndPassword",
    "usage": "Sign",
    "value": "MIIJgIBAzCCCbYGCSqGSIb3gX1MIIF..."
  },
  "passwordCredential": {
    "value": "MKTr0w1ytHhemMDY"
  },
  "proof": "Bearer eyJ0eXAiOiJKv1..."
}
POST https://graph.windows.net/myorganization/applicationsByAppId/1062a13d-f7e5-4ea7-8d24-427f6ff1e5e1/addKey?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#Collection(Microsoft.DirectoryServices.KeyCredential)",
  "value": [
    {
      "keyCredential": {
        "customKeyIdentifier": "JXyLFwBmN=",
        "endDate": "2017-10-11T07:00:00Z",
        "keyId": "633b1614-b669-47c5-961e-f4a45978ffff",
        "startDate": "2012-09-11T07:00:00Z",
        "type": "AsymmetricX509Cert",
        "usage": "Sign",
        "value": null
      }
    },
    {
      "keyCredential": {
        "customKeyIdentifier": "JXyLFwBmN=",
        "endDate": "2017-10-11T07:00:00Z",
        "keyId": "633b1614-b669-47c5-961e-f4a45978ffff",
        "startDate": "2012-09-11T07:00:00Z",
        "type": "Password",
        "usage": "Sign",
        "value": null
      }
    }
  ]
}

Response List

Status CodeDescription
200OK. Indicates success. Returns the application's new key credential and password credential directory object.

assignLicense: Add or remove licenses from a user

POST https://graph.windows.net/myorganization/users/{user_id}/assignLicense?api-version

Parameters

ParameterTypeValueNotes
URL
user_idstring

alexd@a830edad9050849NDA1.onmicrosoft.com

The user ID. Can be the object ID (GUID) or the user principal name (someuser@a830edad9050849NDA1.onmicrosoft.com) of the target user.
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "addLicenses": [
    {
      "disabledPlans": [],
      "skuId": "6fd2c87f-b296-42f0-b197-1e91e994b900"
    }
  ],
  "removeLicenses": []
}
POST https://graph.windows.net/myorganization/users/alexd%40a830edad9050849NDA1.onmicrosoft.com/assignLicense?api-version=1.6

Response

Status Code:200

Content-Type: application/json

none

Response List

Status CodeDescription
200OK. Indicates success. No response body is returned.

changePassword: Change password of the signed-in user

POST https://graph.windows.net/me/changePassword?api-version

Parameters

ParameterTypeValueNotes
Query
api-versionstring

1.6

Specifies the version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "currentPassword": "Test1234!",
  "newPassword": "Test5678!"
}

Response

Status Code:204

Content-Type: application/json

none

Response List

Status CodeDescription
204No Content. Indicates success. No response body is returned.

removeKey: Remove a KeyCredential for an application

POST https://graph.windows.net/myorganization/applications/{application_oid}/removeKey?api-version
POST https://graph.windows.net/myorganization/applications/{application_oid}/removeKey?api-version=1.6

Response

Status Code:204

Content-Type: none

none

Response List

Status CodeDescription
204No Content. Indicates success. No response body is returned.
POST https://graph.windows.net/myorganization/applicationsByAppId/{application_id}/removeKey?api-version
POST https://graph.windows.net/myorganization/applicationsByAppId/1062a13d-f7e5-4ea7-8d24-427f6ff1e5e1/removeKey?api-version=1.6

Response

Status Code:204

Content-Type: none

none

Response List

Status CodeDescription
204No Content. Indicates success. No response body is returned.

restore: Restore a deleted application

POST https://graph.windows.net/myorganization/deletedApplications/{application_id}/restore?api-version

Parameters

ParameterTypeValueNotes
URL
application_idstring

1e22de0f-0ed1-4c01-b725-a822632467e3

The object ID (GUID) of the application to restore.
Query
api-versionstring

1.6

The version of the Graph API to target. Beginning with version 1.5, the api-version string is represented in major.minor format. Prior releases were represented as date strings: '2013-11-08' and '2013-04-05'. Required.
Body

Content-Type: application/json

{
  "identifierUris": [
    "https://restoredApp/"
  ]
}
POST https://graph.windows.net/myorganization/deletedApplications/1e22de0f-0ed1-4c01-b725-a822632467e3/restore?api-version=1.6

Response

Status Code:200

Content-Type: application/json

{
  "odata.metadata": "https://graph.windows.net/myorganization/$metadata#directoryObjects/Microsoft.DirectoryServices.Application/@Element",
  "odata.type": "Microsoft.DirectoryServices.Application",
  "objectType": "Application",
  "objectId": "1e22de0f-0ed1-4c01-b725-a822632467e3",
  "deletionTimestamp": null,
  "appId": "f4ecf40c-e94f-4d79-af83-f920f81bcb66",
  "appRoles": [],
  "availableToOtherTenants": false,
  "displayName": "Sample App 1",
  "errorUrl": null,
  "groupMembershipClaims": null,
  "homepage": "https://localhost",
  "identifierUris": [
    "https://restoredApp/"
  ],
  "keyCredentials": [],
  "knownClientApplications": [],
  "logoutUrl": null,
  "oauth2AllowImplicitFlow": false,
  "oauth2AllowUrlPathMatching": false,
  "oauth2Permissions": [],
  "oauth2RequirePostResponse": false,
  "passwordCredentials": [],
  "publicClient": null,
  "replyUrls": [
    "https://localhost"
  ],
  "requiredResourceAccess": [
    {
      "resourceAppId": "00000002-0000-0000-c000-000000000000",
      "resourceAccess": [
        {
          "id": "311a71cc-e848-46a1-bdf8-97ff7156d8e6",
          "type": "Scope"
        }
      ]
    }
  ],
  "samlMetadataUrl": null
}

Response List

Status CodeDescription
200OK. Indicates success. Returns the restored Application object. The identifierUris property in the restored application is set or restored according to the identifierUris collection specified in the request.

その他のリソース

  • Graph API でサポートされる機能、およびプレビュー機能の詳細については、「Graph API の概念」を参照してください。