名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
要求本文で指定された型の ID プロバイダー オブジェクトを作成します。
identityProviderBase から派生したプロバイダーの種類のうち、Microsoft Entraでは、この操作で socialIdentityProvider、appleManagedIdentityProvider (外部テナントのみ)、または oidcIdentityProvider (外部テナントのみ) リソースを作成できます。
Azure AD B2C では、この操作により 、socialIdentityProvider、 appleManagedIdentityProvider、 builtinIdentityProvider、または openIdConnectIdentityProvider リソースを作成できます。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
IdentityProvider.ReadWrite.All |
注意事項なし。 |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
IdentityProvider.ReadWrite.All |
注意事項なし。 |
重要
職場または学校アカウントを使用した委任されたシナリオでは、サインインしているユーザーに、サポートされているMicrosoft Entraロールまたはサポートされているロールのアクセス許可を持つカスタム ロールを割り当てる必要があります。
外部 ID プロバイダー管理者 は、この操作でサポートされる最小限の特権ロールです。
HTTP 要求
POST /identity/identityProviders
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、Microsoft Entra 外部 IDで socialIdentityProvider、oidcIdentityProvider、または appleManagedIdentityProvider オブジェクトの JSON 表現を指定します。
Azure AD B2C では、 socialIdentityProvider、 openIdConnectIdentityProvider、または appleManagedIdentityProvider オブジェクトの JSON 表現を提供します。
次の表に示すプロパティはすべて必須です。
socialIdentityProvider オブジェクト
プロパティ |
型 |
説明 |
displayName |
String |
ID プロバイダーの表示名。 |
clientId |
文字列 |
アプリケーションを ID プロバイダーに登録した際に取得したクライアント識別子です。 |
clientSecret |
String |
アプリケーションが ID プロバイダーに登録された際に取得したクライアント シークレットです。 これは、書き込み専用です。 読み取り操作を行うと、**** が返されます。 |
identityProviderType |
String |
外部テナントと従業員テナントの場合、使用可能な値: Facebook 、 Google 。 Azure AD B2C テナントの場合、使用可能な値: Microsoft 、 Google 、 Amazon 、 LinkedIn 、 Facebook 、 GitHub 、 Twitter 、 Weibo 、 QQ 、 WeChat 。 |
appleManagedIdentityProvider オブジェクト
プロパティ |
型 |
説明 |
displayName |
String |
ID プロバイダーの表示名。 |
developerId |
String |
Apple の開発者 ID。 |
serviceId |
String |
Apple のサービス ID。 |
keyId |
String |
Apple のキー識別子。 |
certificateData |
String |
証明書からのテキストの長い文字列である証明書データは、null 値である可能性があります。 |
openIdConnectIdentityProvider オブジェクト
プロパティ |
型 |
説明 |
displayName |
String |
ID プロバイダーの表示名。 |
clientId |
文字列 |
アプリケーションを ID プロバイダーに登録した際に取得したクライアント識別子です。 |
clientSecret |
String |
アプリケーションを ID プロバイダーに登録した際に取得したクライアント シークレットです。 clientSecret は responseType に依存しています。 -
responseType が
code 場合、認証コード交換にはシークレットが必要です。 -
responseType が
id_token 場合、認証パイプラインにコード交換がないため、シークレットは必要ありません。 このモードでは、id_tokenは承認応答から直接返されます。
|
domainHint |
String |
ドメイン ヒントを使用すると、ユーザーが使用可能な ID プロバイダーの一覧を選択するのではなく、指定した ID プロバイダーのサインイン ページに直接スキップできます。 |
claimsMapping |
claimsMapping |
OIDC プロバイダーが ID トークンをMicrosoft Entra IDに送信した後、Microsoft Entra IDは、受信したトークンからの要求を、認識して使用する要求Microsoft Entra IDマップできる必要があります。 この複合型は、そのマッピングをキャプチャします。 |
metadataUrl |
String |
OpenID Connect ID プロバイダーのメタデータ ドキュメントの URL。 すべての OpenID Connect ID プロバイダーは、サインインを実行するために必要なほとんどの情報を含むメタデータ ドキュメントを記述します。 これには、使用する URL やサービスの公開署名キーの場所などの情報が含まれます。 OpenID Connect メタデータ ドキュメントは常に、 .well-known/openid-configuration で終わるエンドポイントにあります。 追加する OpenID Connect ID プロバイダーのメタデータ URL を指定します。 |
responseMode |
String |
応答モードでは、カスタム ID プロバイダーから Azure AD B2C にデータを送信するために使用されるメソッドを定義します。 使用可能な値: form_post 、 query 。 |
responseType |
String |
応答の種類は、カスタム ID プロバイダーのauthorization_endpointへの最初の呼び出しで返される情報の種類を表します。 使用可能な値: code 、 id_token 、 token 。 |
scope |
String |
スコープは、カスタム ID プロバイダーから収集する情報とアクセス許可を定義します。 |
oidcIdentityProvider オブジェクト
プロパティ |
型 |
説明 |
clientAuthentication |
oidcClientAuthentication |
クライアント認証設定。
oidcClientSecretAuthentication 派生複合型を使用して、client_secret_post または client_secret_jwt authentication メソッドを使用して ID プロバイダーを設定します。 認証方法を使用して ID プロバイダーを設定するには、 oidcPrivateJwtKeyClientAuthentication 型 private_key_jwt 使用します。
セキュリティ上の理由から、 client_secret_basic 認証方法はサポートされていません。 |
clientId |
文字列 |
アプリケーションを ID プロバイダーに登録した際に取得したクライアント ID です。 |
displayName |
String |
ID プロバイダーの表示名。
identityProviderBase から継承されます。 |
id |
String |
ID プロバイダーの識別子。必須。
identityProviderBase から継承されます。
エンティティから継承します |
inboundClaimMapping |
oidcInboundClaimMappingOverride |
OIDC プロバイダーが ID トークンをMicrosoft Entra 外部 IDに送信した後、Microsoft Entra 外部 IDは、受信したトークンからの要求を、Microsoft Entra IDが認識して使用する要求にマップできる必要があります。 この複合型は、そのマッピングをキャプチャします。 |
発行者 |
String |
発行者 URI。 発行者 URI は、https スキームを使用した大文字と小文字が区別される URL で、スキーム、ホスト、および必要に応じてポート番号とパス のコンポーネントが含まれており、クエリまたはフラグメント コンポーネントはありません。
手記:他のMicrosoft Entraテナントを外部 ID プロバイダーとして構成することは現在サポートされていません。 その結果、発行者 URI の microsoftonline.com ドメインは受け入れられない。 |
responseType |
oidcResponseType |
応答の種類は、カスタム ID プロバイダーのauthorization_endpointへの最初の呼び出しで返される情報の種類を表します。 使用可能な値:
code : 承認コード フローに従って、コードが Entra 外部 IDに返されます。 Entra 外部 IDは、token_endpointを呼び出してトークンのコードを交換します。
id_token : ID トークンは、カスタム ID プロバイダーから Entra 外部 IDに返されます。 (現時点では、この値はサポートされていません)。
token : アクセス トークンは、カスタム ID プロバイダーから Entra 外部 IDに返されます。 この値は現在サポートされていません。 |
scope |
String |
スコープは、カスタム ID プロバイダーから収集する情報とアクセス許可を定義します。 |
wellKnownEndpoint |
String |
OpenID Connect ID プロバイダーのメタデータ ドキュメントの URL。 すべての OpenID Connect ID プロバイダーは、サインインを実行するために必要なほとんどの情報を含むメタデータ ドキュメントを記述します。 これには、使用する URL やサービスの公開署名キーの場所などの情報が含まれます。 OpenID Connect メタデータ ドキュメントは常に、 .well-known/openid-configuration で終わるエンドポイントにあります。
手記: メタデータ ドキュメントには、少なくとも、 issuer 、 authorization_endpoint 、 token_endpoint 、 token_endpoint_auth_methods_supported 、 response_types_supported 、 subject_types_supported 、 jwks_uri の各プロパティが含まれている必要があります。 詳細については、「 OpenID Connect Discovery の仕様」を参照してください。 |
応答
成功した場合、このメソッドは、201 Created
応答コードと、Microsoft Entra テナントの応答本文の socialIdentityProvider オブジェクトの JSON 表現を返します。
Azure AD B2C テナントの場合、このメソッドは 201 Created
応答コードと、応答本文の socialIdentityProvider、 openIdConnectIdentityProvider、または appleManagedIdentityProvider オブジェクトの JSON 表現を返します。
失敗した場合、4xx
エラーが詳細情報とともに返されます。
例
例 1: ソーシャル ID プロバイダーを作成する
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/identity/identityProviders
Content-type: application/json
{
"@odata.type": "microsoft.graph.socialIdentityProvider",
"displayName": "Login with Amazon",
"identityProviderType": "Amazon",
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",
"clientSecret": "42*****96"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new SocialIdentityProvider
{
OdataType = "microsoft.graph.socialIdentityProvider",
DisplayName = "Login with Amazon",
IdentityProviderType = "Amazon",
ClientId = "00001111-aaaa-2222-bbbb-3333cccc4444",
ClientSecret = "42*****96",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.IdentityProviders.PostAsync(requestBody);
mgc-beta identity identity-providers create --body '{\
"@odata.type": "microsoft.graph.socialIdentityProvider",\
"displayName": "Login with Amazon",\
"identityProviderType": "Amazon",\
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",\
"clientSecret": "42*****96"\
}\
'
// 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.NewIdentityProviderBase()
displayName := "Login with Amazon"
requestBody.SetDisplayName(&displayName)
identityProviderType := "Amazon"
requestBody.SetIdentityProviderType(&identityProviderType)
clientId := "00001111-aaaa-2222-bbbb-3333cccc4444"
requestBody.SetClientId(&clientId)
clientSecret := "42*****96"
requestBody.SetClientSecret(&clientSecret)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
identityProviders, err := graphClient.Identity().IdentityProviders().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
SocialIdentityProvider identityProviderBase = new SocialIdentityProvider();
identityProviderBase.setOdataType("microsoft.graph.socialIdentityProvider");
identityProviderBase.setDisplayName("Login with Amazon");
identityProviderBase.setIdentityProviderType("Amazon");
identityProviderBase.setClientId("00001111-aaaa-2222-bbbb-3333cccc4444");
identityProviderBase.setClientSecret("42*****96");
IdentityProviderBase result = graphClient.identity().identityProviders().post(identityProviderBase);
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': 'microsoft.graph.socialIdentityProvider',
displayName: 'Login with Amazon',
identityProviderType: 'Amazon',
clientId: '00001111-aaaa-2222-bbbb-3333cccc4444',
clientSecret: '42*****96'
};
await client.api('/identity/identityProviders')
.version('beta')
.post(identityProviderBase);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\SocialIdentityProvider;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new SocialIdentityProvider();
$requestBody->setOdataType('microsoft.graph.socialIdentityProvider');
$requestBody->setDisplayName('Login with Amazon');
$requestBody->setIdentityProviderType('Amazon');
$requestBody->setClientId('00001111-aaaa-2222-bbbb-3333cccc4444');
$requestBody->setClientSecret('42*****96');
$result = $graphServiceClient->identity()->identityProviders()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
"@odata.type" = "microsoft.graph.socialIdentityProvider"
displayName = "Login with Amazon"
identityProviderType = "Amazon"
clientId = "00001111-aaaa-2222-bbbb-3333cccc4444"
clientSecret = "42*****96"
}
New-MgBetaIdentityProvider -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.social_identity_provider import SocialIdentityProvider
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = SocialIdentityProvider(
odata_type = "microsoft.graph.socialIdentityProvider",
display_name = "Login with Amazon",
identity_provider_type = "Amazon",
client_id = "00001111-aaaa-2222-bbbb-3333cccc4444",
client_secret = "42*****96",
)
result = await graph_client.identity.identity_providers.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.type": "microsoft.graph.socialIdentityProvider",
"id": "Amazon-OAUTH",
"displayName": "Login with Amazon",
"identityProviderType": "Amazon",
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",
"clientSecret": "42*****96"
}
例 2: Apple ID プロバイダーを作成する
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/identity/identityProviders
Content-type: application/json
{
"@odata.type": "microsoft.graph.appleManagedIdentityProvider",
"displayName": "Apple",
"developerId": "qazx.1234",
"serviceId": "com.contoso.app",
"keyId": "4294967296",
"certificateData": "******"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new AppleManagedIdentityProvider
{
OdataType = "microsoft.graph.appleManagedIdentityProvider",
DisplayName = "Apple",
DeveloperId = "qazx.1234",
ServiceId = "com.contoso.app",
KeyId = "4294967296",
CertificateData = "******",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.IdentityProviders.PostAsync(requestBody);
mgc-beta identity identity-providers create --body '{\
"@odata.type": "microsoft.graph.appleManagedIdentityProvider",\
"displayName": "Apple",\
"developerId": "qazx.1234",\
"serviceId": "com.contoso.app",\
"keyId": "4294967296",\
"certificateData": "******"\
}\
'
// 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.NewIdentityProviderBase()
displayName := "Apple"
requestBody.SetDisplayName(&displayName)
developerId := "qazx.1234"
requestBody.SetDeveloperId(&developerId)
serviceId := "com.contoso.app"
requestBody.SetServiceId(&serviceId)
keyId := "4294967296"
requestBody.SetKeyId(&keyId)
certificateData := "******"
requestBody.SetCertificateData(&certificateData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
identityProviders, err := graphClient.Identity().IdentityProviders().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AppleManagedIdentityProvider identityProviderBase = new AppleManagedIdentityProvider();
identityProviderBase.setOdataType("microsoft.graph.appleManagedIdentityProvider");
identityProviderBase.setDisplayName("Apple");
identityProviderBase.setDeveloperId("qazx.1234");
identityProviderBase.setServiceId("com.contoso.app");
identityProviderBase.setKeyId("4294967296");
identityProviderBase.setCertificateData("******");
IdentityProviderBase result = graphClient.identity().identityProviders().post(identityProviderBase);
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': 'microsoft.graph.appleManagedIdentityProvider',
displayName: 'Apple',
developerId: 'qazx.1234',
serviceId: 'com.contoso.app',
keyId: '4294967296',
certificateData: '******'
};
await client.api('/identity/identityProviders')
.version('beta')
.post(identityProviderBase);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\AppleManagedIdentityProvider;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AppleManagedIdentityProvider();
$requestBody->setOdataType('microsoft.graph.appleManagedIdentityProvider');
$requestBody->setDisplayName('Apple');
$requestBody->setDeveloperId('qazx.1234');
$requestBody->setServiceId('com.contoso.app');
$requestBody->setKeyId('4294967296');
$requestBody->setCertificateData('******');
$result = $graphServiceClient->identity()->identityProviders()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
"@odata.type" = "microsoft.graph.appleManagedIdentityProvider"
displayName = "Apple"
developerId = "qazx.1234"
serviceId = "com.contoso.app"
keyId = "4294967296"
certificateData = "******"
}
New-MgBetaIdentityProvider -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.apple_managed_identity_provider import AppleManagedIdentityProvider
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AppleManagedIdentityProvider(
odata_type = "microsoft.graph.appleManagedIdentityProvider",
display_name = "Apple",
developer_id = "qazx.1234",
service_id = "com.contoso.app",
key_id = "4294967296",
certificate_data = "******",
)
result = await graph_client.identity.identity_providers.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.type": "microsoft.graph.appleManagedIdentityProvider",
"id": "Apple-Managed-OIDC",
"displayName": "Apple",
"developerId": "qazx.1234",
"serviceId": "com.contoso.app",
"keyId": "4294967296",
"certificateData": "******"
}
例 3: OpenID Connect ID プロバイダー (B2C テナント) を作成する
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/identity/identityProviders
Content-type: application/json
{
"@odata.type": "microsoft.graph.openIdConnectIdentityProvider",
"displayName": "Contoso",
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",
"clientSecret": "4294967296",
"claimsMapping": {
"userId": "myUserId",
"givenName": "myGivenName",
"surname": "mySurname",
"email": "myEmail",
"displayName": "myDisplayName"
},
"domainHint": "mycustomoidc",
"metadataUrl": "https://mycustomoidc.com/.well-known/openid-configuration",
"responseMode": "form_post",
"responseType": "code",
"scope": "openid"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new OpenIdConnectIdentityProvider
{
OdataType = "microsoft.graph.openIdConnectIdentityProvider",
DisplayName = "Contoso",
ClientId = "00001111-aaaa-2222-bbbb-3333cccc4444",
ClientSecret = "4294967296",
ClaimsMapping = new ClaimsMapping
{
UserId = "myUserId",
GivenName = "myGivenName",
Surname = "mySurname",
Email = "myEmail",
DisplayName = "myDisplayName",
},
DomainHint = "mycustomoidc",
MetadataUrl = "https://mycustomoidc.com/.well-known/openid-configuration",
ResponseMode = OpenIdConnectResponseMode.Form_post,
ResponseType = OpenIdConnectResponseTypes.Code,
Scope = "openid",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.IdentityProviders.PostAsync(requestBody);
mgc-beta identity identity-providers create --body '{\
"@odata.type": "microsoft.graph.openIdConnectIdentityProvider",\
"displayName": "Contoso",\
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",\
"clientSecret": "4294967296",\
"claimsMapping": {\
"userId": "myUserId",\
"givenName": "myGivenName",\
"surname": "mySurname",\
"email": "myEmail",\
"displayName": "myDisplayName"\
},\
"domainHint": "mycustomoidc",\
"metadataUrl": "https://mycustomoidc.com/.well-known/openid-configuration",\
"responseMode": "form_post",\
"responseType": "code",\
"scope": "openid"\
}\
\
'
// 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.NewIdentityProviderBase()
displayName := "Contoso"
requestBody.SetDisplayName(&displayName)
clientId := "00001111-aaaa-2222-bbbb-3333cccc4444"
requestBody.SetClientId(&clientId)
clientSecret := "4294967296"
requestBody.SetClientSecret(&clientSecret)
claimsMapping := graphmodels.NewClaimsMapping()
userId := "myUserId"
claimsMapping.SetUserId(&userId)
givenName := "myGivenName"
claimsMapping.SetGivenName(&givenName)
surname := "mySurname"
claimsMapping.SetSurname(&surname)
email := "myEmail"
claimsMapping.SetEmail(&email)
displayName := "myDisplayName"
claimsMapping.SetDisplayName(&displayName)
requestBody.SetClaimsMapping(claimsMapping)
domainHint := "mycustomoidc"
requestBody.SetDomainHint(&domainHint)
metadataUrl := "https://mycustomoidc.com/.well-known/openid-configuration"
requestBody.SetMetadataUrl(&metadataUrl)
responseMode := graphmodels.FORM_POST_OPENIDCONNECTRESPONSEMODE
requestBody.SetResponseMode(&responseMode)
responseType := graphmodels.CODE_OPENIDCONNECTRESPONSETYPES
requestBody.SetResponseType(&responseType)
scope := "openid"
requestBody.SetScope(&scope)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
identityProviders, err := graphClient.Identity().IdentityProviders().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OpenIdConnectIdentityProvider identityProviderBase = new OpenIdConnectIdentityProvider();
identityProviderBase.setOdataType("microsoft.graph.openIdConnectIdentityProvider");
identityProviderBase.setDisplayName("Contoso");
identityProviderBase.setClientId("00001111-aaaa-2222-bbbb-3333cccc4444");
identityProviderBase.setClientSecret("4294967296");
ClaimsMapping claimsMapping = new ClaimsMapping();
claimsMapping.setUserId("myUserId");
claimsMapping.setGivenName("myGivenName");
claimsMapping.setSurname("mySurname");
claimsMapping.setEmail("myEmail");
claimsMapping.setDisplayName("myDisplayName");
identityProviderBase.setClaimsMapping(claimsMapping);
identityProviderBase.setDomainHint("mycustomoidc");
identityProviderBase.setMetadataUrl("https://mycustomoidc.com/.well-known/openid-configuration");
identityProviderBase.setResponseMode(OpenIdConnectResponseMode.Form_post);
identityProviderBase.setResponseType(EnumSet.of(OpenIdConnectResponseTypes.Code));
identityProviderBase.setScope("openid");
IdentityProviderBase result = graphClient.identity().identityProviders().post(identityProviderBase);
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': 'microsoft.graph.openIdConnectIdentityProvider',
displayName: 'Contoso',
clientId: '00001111-aaaa-2222-bbbb-3333cccc4444',
clientSecret: '4294967296',
claimsMapping: {
userId: 'myUserId',
givenName: 'myGivenName',
surname: 'mySurname',
email: 'myEmail',
displayName: 'myDisplayName'
},
domainHint: 'mycustomoidc',
metadataUrl: 'https://mycustomoidc.com/.well-known/openid-configuration',
responseMode: 'form_post',
responseType: 'code',
scope: 'openid'
};
await client.api('/identity/identityProviders')
.version('beta')
.post(identityProviderBase);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\OpenIdConnectIdentityProvider;
use Microsoft\Graph\Beta\Generated\Models\ClaimsMapping;
use Microsoft\Graph\Beta\Generated\Models\OpenIdConnectResponseMode;
use Microsoft\Graph\Beta\Generated\Models\OpenIdConnectResponseTypes;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OpenIdConnectIdentityProvider();
$requestBody->setOdataType('microsoft.graph.openIdConnectIdentityProvider');
$requestBody->setDisplayName('Contoso');
$requestBody->setClientId('00001111-aaaa-2222-bbbb-3333cccc4444');
$requestBody->setClientSecret('4294967296');
$claimsMapping = new ClaimsMapping();
$claimsMapping->setUserId('myUserId');
$claimsMapping->setGivenName('myGivenName');
$claimsMapping->setSurname('mySurname');
$claimsMapping->setEmail('myEmail');
$claimsMapping->setDisplayName('myDisplayName');
$requestBody->setClaimsMapping($claimsMapping);
$requestBody->setDomainHint('mycustomoidc');
$requestBody->setMetadataUrl('https://mycustomoidc.com/.well-known/openid-configuration');
$requestBody->setResponseMode(new OpenIdConnectResponseMode('form_post'));
$requestBody->setResponseType(new OpenIdConnectResponseTypes('code'));
$requestBody->setScope('openid');
$result = $graphServiceClient->identity()->identityProviders()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
"@odata.type" = "microsoft.graph.openIdConnectIdentityProvider"
displayName = "Contoso"
clientId = "00001111-aaaa-2222-bbbb-3333cccc4444"
clientSecret = "4294967296"
claimsMapping = @{
userId = "myUserId"
givenName = "myGivenName"
surname = "mySurname"
email = "myEmail"
displayName = "myDisplayName"
}
domainHint = "mycustomoidc"
metadataUrl = "https://mycustomoidc.com/.well-known/openid-configuration"
responseMode = "form_post"
responseType = "code"
scope = "openid"
}
New-MgBetaIdentityProvider -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.open_id_connect_identity_provider import OpenIdConnectIdentityProvider
from msgraph_beta.generated.models.claims_mapping import ClaimsMapping
from msgraph_beta.generated.models.open_id_connect_response_mode import OpenIdConnectResponseMode
from msgraph_beta.generated.models.open_id_connect_response_types import OpenIdConnectResponseTypes
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OpenIdConnectIdentityProvider(
odata_type = "microsoft.graph.openIdConnectIdentityProvider",
display_name = "Contoso",
client_id = "00001111-aaaa-2222-bbbb-3333cccc4444",
client_secret = "4294967296",
claims_mapping = ClaimsMapping(
user_id = "myUserId",
given_name = "myGivenName",
surname = "mySurname",
email = "myEmail",
display_name = "myDisplayName",
),
domain_hint = "mycustomoidc",
metadata_url = "https://mycustomoidc.com/.well-known/openid-configuration",
response_mode = OpenIdConnectResponseMode.Form_post,
response_type = OpenIdConnectResponseTypes.Code,
scope = "openid",
)
result = await graph_client.identity.identity_providers.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.type": "microsoft.graph.openIdConnectIdentityProvider",
"id": "Contoso-OIDC-00001111-aaaa-2222-bbbb-3333cccc4444",
"displayName": "Contoso",
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",
"clientSecret": "4294967296",
"claimsMapping": {
"userId": "myUserId",
"givenName": "myGivenName",
"surname": "mySurname",
"email": "myEmail",
"displayName": "myDisplayName"
},
"domainHint": "mycustomoidc",
"metadataUrl": "https://mycustomoidc.com/.well-known/openid-configuration",
"responseMode": "form_post",
"responseType": "code",
"scope": "openid"
}
例 4: OpenID Connect ID プロバイダー (外部テナント) を作成する
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/identity/identityProviders
Content-type: application/json
{
"@odata.type": "#microsoft.graph.OidcIdentityProvider",
"displayName": "Contoso AAD B2C",
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",
"issuer": "https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/",
"wellKnownEndpoint": "https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL",
"responseType": "code",
"scope": "openid profile email offline_access",
"clientAuthentication": {
"@odata.type": "#microsoft.graph.oidcClientSecretAuthentication",
"clientSecret": "4294967296"
},
"inboundClaimMapping": {
"sub": "sub",
"name": "name",
"given_name": "given_name",
"family_name": "family_name",
"email": "email",
"email_verified": "email_verified",
"phone_number": "phone_number",
"phone_number_verified": "phone_number_verified",
"address": {
"street_address": "street_address",
"locality": "locality",
"region": "region",
"postal_code": "postal_code",
"country": "country"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new IdentityProviderBase
{
OdataType = "#microsoft.graph.OidcIdentityProvider",
DisplayName = "Contoso AAD B2C",
AdditionalData = new Dictionary<string, object>
{
{
"clientId" , "00001111-aaaa-2222-bbbb-3333cccc4444"
},
{
"issuer" , "https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/"
},
{
"wellKnownEndpoint" , "https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL"
},
{
"responseType" , "code"
},
{
"scope" , "openid profile email offline_access"
},
{
"clientAuthentication" , new OidcClientSecretAuthentication
{
OdataType = "#microsoft.graph.oidcClientSecretAuthentication",
ClientSecret = "4294967296",
}
},
{
"inboundClaimMapping" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"sub", new UntypedString("sub")
},
{
"name", new UntypedString("name")
},
{
"given_name", new UntypedString("given_name")
},
{
"family_name", new UntypedString("family_name")
},
{
"email", new UntypedString("email")
},
{
"email_verified", new UntypedString("email_verified")
},
{
"phone_number", new UntypedString("phone_number")
},
{
"phone_number_verified", new UntypedString("phone_number_verified")
},
{
"address", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"street_address", new UntypedString("street_address")
},
{
"locality", new UntypedString("locality")
},
{
"region", new UntypedString("region")
},
{
"postal_code", new UntypedString("postal_code")
},
{
"country", new UntypedString("country")
},
})
},
})
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.IdentityProviders.PostAsync(requestBody);
mgc-beta identity identity-providers create --body '{\
"@odata.type": "#microsoft.graph.OidcIdentityProvider",\
"displayName": "Contoso AAD B2C",\
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",\
"issuer": "https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/",\
"wellKnownEndpoint": "https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL",\
"responseType": "code",\
"scope": "openid profile email offline_access",\
"clientAuthentication": {\
"@odata.type": "#microsoft.graph.oidcClientSecretAuthentication",\
"clientSecret": "4294967296"\
},\
"inboundClaimMapping": {\
"sub": "sub",\
"name": "name",\
"given_name": "given_name",\
"family_name": "family_name",\
"email": "email",\
"email_verified": "email_verified",\
"phone_number": "phone_number",\
"phone_number_verified": "phone_number_verified",\
"address": {\
"street_address": "street_address",\
"locality": "locality",\
"region": "region",\
"postal_code": "postal_code",\
"country": "country"\
}\
}\
}\
'
// 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.NewIdentityProviderBase()
displayName := "Contoso AAD B2C"
requestBody.SetDisplayName(&displayName)
additionalData := map[string]interface{}{
"clientId" : "00001111-aaaa-2222-bbbb-3333cccc4444",
"issuer" : "https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/",
"wellKnownEndpoint" : "https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL",
"responseType" : "code",
"scope" : "openid profile email offline_access",
clientAuthentication := graphmodels.NewOidcClientSecretAuthentication()
clientSecret := "4294967296"
clientAuthentication.SetClientSecret(&clientSecret)
requestBody.SetClientAuthentication(clientAuthentication)
inboundClaimMapping := graph.New()
sub := "sub"
inboundClaimMapping.SetSub(&sub)
name := "name"
inboundClaimMapping.SetName(&name)
given_name := "given_name"
inboundClaimMapping.SetGiven_name(&given_name)
family_name := "family_name"
inboundClaimMapping.SetFamily_name(&family_name)
email := "email"
inboundClaimMapping.SetEmail(&email)
email_verified := "email_verified"
inboundClaimMapping.SetEmail_verified(&email_verified)
phone_number := "phone_number"
inboundClaimMapping.SetPhone_number(&phone_number)
phone_number_verified := "phone_number_verified"
inboundClaimMapping.SetPhone_number_verified(&phone_number_verified)
address := graph.New()
street_address := "street_address"
address.SetStreet_address(&street_address)
locality := "locality"
address.SetLocality(&locality)
region := "region"
address.SetRegion(®ion)
postal_code := "postal_code"
address.SetPostal_code(&postal_code)
country := "country"
address.SetCountry(&country)
inboundClaimMapping.SetAddress(address)
requestBody.SetInboundClaimMapping(inboundClaimMapping)
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
identityProviders, err := graphClient.Identity().IdentityProviders().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
IdentityProviderBase identityProviderBase = new IdentityProviderBase();
identityProviderBase.setOdataType("#microsoft.graph.OidcIdentityProvider");
identityProviderBase.setDisplayName("Contoso AAD B2C");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("clientId", "00001111-aaaa-2222-bbbb-3333cccc4444");
additionalData.put("issuer", "https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/");
additionalData.put("wellKnownEndpoint", "https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL");
additionalData.put("responseType", "code");
additionalData.put("scope", "openid profile email offline_access");
OidcClientSecretAuthentication clientAuthentication = new OidcClientSecretAuthentication();
clientAuthentication.setOdataType("#microsoft.graph.oidcClientSecretAuthentication");
clientAuthentication.setClientSecret("4294967296");
additionalData.put("clientAuthentication", clientAuthentication);
inboundClaimMapping = new ();
inboundClaimMapping.setSub("sub");
inboundClaimMapping.setName("name");
inboundClaimMapping.setGivenName("given_name");
inboundClaimMapping.setFamilyName("family_name");
inboundClaimMapping.setEmail("email");
inboundClaimMapping.setEmailVerified("email_verified");
inboundClaimMapping.setPhoneNumber("phone_number");
inboundClaimMapping.setPhoneNumberVerified("phone_number_verified");
address = new ();
address.setStreetAddress("street_address");
address.setLocality("locality");
address.setRegion("region");
address.setPostalCode("postal_code");
address.setCountry("country");
inboundClaimMapping.setAddress(address);
additionalData.put("inboundClaimMapping", inboundClaimMapping);
identityProviderBase.setAdditionalData(additionalData);
IdentityProviderBase result = graphClient.identity().identityProviders().post(identityProviderBase);
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': '#microsoft.graph.OidcIdentityProvider',
displayName: 'Contoso AAD B2C',
clientId: '00001111-aaaa-2222-bbbb-3333cccc4444',
issuer: 'https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/',
wellKnownEndpoint: 'https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL',
responseType: 'code',
scope: 'openid profile email offline_access',
clientAuthentication: {
'@odata.type': '#microsoft.graph.oidcClientSecretAuthentication',
clientSecret: '4294967296'
},
inboundClaimMapping: {
sub: 'sub',
name: 'name',
given_name: 'given_name',
family_name: 'family_name',
email: 'email',
email_verified: 'email_verified',
phone_number: 'phone_number',
phone_number_verified: 'phone_number_verified',
address: {
street_address: 'street_address',
locality: 'locality',
region: 'region',
postal_code: 'postal_code',
country: 'country'
}
}
};
await client.api('/identity/identityProviders')
.version('beta')
.post(identityProviderBase);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\IdentityProviderBase;
use Microsoft\Graph\Beta\Generated\Models\OidcClientSecretAuthentication;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new IdentityProviderBase();
$requestBody->setOdataType('#microsoft.graph.OidcIdentityProvider');
$requestBody->setDisplayName('Contoso AAD B2C');
$additionalData = [
'clientId' => '00001111-aaaa-2222-bbbb-3333cccc4444',
'issuer' => 'https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/',
'wellKnownEndpoint' => 'https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL',
'responseType' => 'code',
'scope' => 'openid profile email offline_access',
'clientAuthentication' => [
'@odata.type' => '#microsoft.graph.oidcClientSecretAuthentication',
'clientSecret' => '4294967296',
],
'inboundClaimMapping' => [
'sub' => 'sub',
'name' => 'name',
'given_name' => 'given_name',
'family_name' => 'family_name',
'email' => 'email',
'email_verified' => 'email_verified',
'phone_number' => 'phone_number',
'phone_number_verified' => 'phone_number_verified',
'address' => [
'street_address' => 'street_address',
'locality' => 'locality',
'region' => 'region',
'postal_code' => 'postal_code',
'country' => 'country',
],
],
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->identity()->identityProviders()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.OidcIdentityProvider"
displayName = "Contoso AAD B2C"
clientId = "00001111-aaaa-2222-bbbb-3333cccc4444"
issuer = "https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/"
wellKnownEndpoint = "https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL"
responseType = "code"
scope = "openid profile email offline_access"
clientAuthentication = @{
"@odata.type" = "#microsoft.graph.oidcClientSecretAuthentication"
clientSecret = "4294967296"
}
inboundClaimMapping = @{
sub = "sub"
name = "name"
given_name = "given_name"
family_name = "family_name"
email = "email"
email_verified = "email_verified"
phone_number = "phone_number"
phone_number_verified = "phone_number_verified"
address = @{
street_address = "street_address"
locality = "locality"
region = "region"
postal_code = "postal_code"
country = "country"
}
}
}
New-MgBetaIdentityProvider -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.identity_provider_base import IdentityProviderBase
from msgraph_beta.generated.models.oidc_client_secret_authentication import OidcClientSecretAuthentication
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = IdentityProviderBase(
odata_type = "#microsoft.graph.OidcIdentityProvider",
display_name = "Contoso AAD B2C",
additional_data = {
"client_id" : "00001111-aaaa-2222-bbbb-3333cccc4444",
"issuer" : "https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/",
"well_known_endpoint" : "https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL",
"response_type" : "code",
"scope" : "openid profile email offline_access",
"client_authentication" : {
"@odata_type" : "#microsoft.graph.oidcClientSecretAuthentication",
"client_secret" : "4294967296",
},
"inbound_claim_mapping" : {
"sub" : "sub",
"name" : "name",
"given_name" : "given_name",
"family_name" : "family_name",
"email" : "email",
"email_verified" : "email_verified",
"phone_number" : "phone_number",
"phone_number_verified" : "phone_number_verified",
"address" : {
"street_address" : "street_address",
"locality" : "locality",
"region" : "region",
"postal_code" : "postal_code",
"country" : "country",
},
},
}
)
result = await graph_client.identity.identity_providers.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.type": "#microsoft.graph.OidcIdentityProvider",
"id": "12345678-abcd-1234-cdef-aaaaaaaaaaaa",
"displayName": "Contoso AAD B2C",
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",
"issuer": "https://contoso.b2clogin.com/00001111-aaaa-2222-bbbb-3333cccc4444/v2.0/",
"wellKnownEndpoint": "https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_SIGNINEMAIL",
"responseType": "code",
"scope": "openid profile email offline_access",
"clientAuthentication": {
"@odata.type": "#microsoft.graph.oidcClientSecretAuthentication",
"clientSecret": "*****"
},
"inboundClaimMapping": {
"sub": "sub",
"name": "name",
"given_name": "given_name",
"family_name": "family_name",
"email": "email",
"email_verified": "email_verified",
"phone_number": "phone_number",
"phone_number_verified": "phone_number_verified",
"address": {
"street_address": "street_address",
"locality": "locality",
"region": "region",
"postal_code": "postal_code",
"country": "country"
}
}
}