identityProvider を作成する
-
[アーティクル]
-
-
名前空間: microsoft.graph
要求本文で指定された種類の ID プロバイダー リソースを作成します。
identityProviderBase から派生したプロバイダーの種類の中で、現在、ソーシャルIdentityProviderリソースを Azure AD。 B2C Azure AD、この操作は現在、socialIdentityProviderまたはappleManagedIdentityProviderリソースを作成できます。
アクセス許可
この API を呼び出すには、次のいずれかのアクセス許可が必要です。アクセス許可の選択方法などの詳細については、「アクセス許可」を参照してください。
| アクセス許可の種類 |
アクセス許可 (特権の小さいものから大きいものへ) |
| 委任 (職場または学校のアカウント) |
IdentityProvider.ReadWrite.All |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
| アプリケーション |
IdentityProvider.ReadWrite.All |
仕事または学校のアカウントは、次のいずれかの役割に属している必要があります。
HTTP 要求
POST /identity/identityProviders
| 名前 |
説明 |
| Authorization |
ベアラー {token}。必須。 |
| Content-Type |
application/json. Required. |
要求本文
要求本文で、ソーシャルIdentityProviderオブジェクトの JSON 表記を指定Azure AD。
このAzure AD B2C は、socialIdentityProvider、または appleManagedIdentityProviderオブジェクトの JSON 表現を提供します。
socialIdentityProvider オブジェクト
| プロパティ |
型 |
説明 |
| clientId |
文字列 |
アプリケーションを ID プロバイダーに登録した際に取得したクライアント識別子です。 |
| clientSecret |
String |
アプリケーションが ID プロバイダーに登録された際に取得したクライアント シークレットです。 これは、書き込み専用です。 読み取り操作を行うと、**** が返されます。 |
| displayName |
String |
ID プロバイダーの表示名。 |
| identityProviderType |
String |
B2B シナリオでは、次の値が使用されます。Google、Facebook。 B2B シナリオでは、次の値が使用されます。Microsoft、Google、Amazon、LinkedIn、Facebook、GitHub、Twitter、Weibo、QQ、WeChat。 |
| scope |
String |
スコープは、カスタム ID プロバイダーから収集する情報とアクセス許可を定義します。 |
appleIdentityProvider オブジェクト
| プロパティ |
型 |
説明 |
| displayName |
String |
ID プロバイダーの表示名。 |
| developerId |
String |
Apple の開発者 ID。 |
| serviceId |
String |
Apple のサービス ID。 |
| keyId |
String |
Apple のキー識別子。 |
| certificateData |
String |
証明書からのテキストの長い文字列である証明書データは、null 値である可能性があります。 |
応答
成功した場合、このメソッドは、応答コードと、テナントの応答本文で 201 Created socialIdentityProviderオブジェクトの JSON 表現をAzure ADします。
B2C Azure ADの場合、このメソッドは応答コードと、応答本文の 201 Created socialIdentityProvider、または appleManagedIdentityProviderオブジェクトの JSON 表現を返します。
失敗した場合、4xx エラーが詳細情報とともに返されます。
例
例 1: 特定のソーシャル ID プロバイダーを作成する (Azure AD B2C Azure AD)
要求
要求の例を次に示します。
POST https://graph.microsoft.com/v1.0/identity/identityProviders
Content-type: application/json
{
"@odata.type": "microsoft.graph.socialIdentityProvider",
"displayName": "Login with Amazon",
"identityProviderType": "Amazon",
"clientId": "56433757-cadd-4135-8431-2c9e3fd68ae8",
"clientSecret": "000000000000"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var identityProviderBase = new SocialIdentityProvider
{
DisplayName = "Login with Amazon",
IdentityProviderType = "Amazon",
ClientId = "56433757-cadd-4135-8431-2c9e3fd68ae8",
ClientSecret = "000000000000"
};
await graphClient.Identity.IdentityProviders
.Request()
.AddAsync(identityProviderBase);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': 'microsoft.graph.socialIdentityProvider',
displayName: 'Login with Amazon',
identityProviderType: 'Amazon',
clientId: '56433757-cadd-4135-8431-2c9e3fd68ae8',
clientSecret: '000000000000'
};
await client.api('/identity/identityProviders')
.post(identityProviderBase);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/identity/identityProviders"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphIdentityProviderBase *identityProviderBase = [[MSGraphIdentityProviderBase alloc] init];
[identityProviderBase setDisplayName:@"Login with Amazon"];
[identityProviderBase setIdentityProviderType:@"Amazon"];
[identityProviderBase setClientId:@"56433757-cadd-4135-8431-2c9e3fd68ae8"];
[identityProviderBase setClientSecret:@"000000000000"];
NSError *error;
NSData *identityProviderBaseData = [identityProviderBase getSerializedDataWithError:&error];
[urlRequest setHTTPBody:identityProviderBaseData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
SocialIdentityProvider identityProviderBase = new SocialIdentityProvider();
identityProviderBase.displayName = "Login with Amazon";
identityProviderBase.identityProviderType = "Amazon";
identityProviderBase.clientId = "56433757-cadd-4135-8431-2c9e3fd68ae8";
identityProviderBase.clientSecret = "000000000000";
graphClient.identity().identityProviders()
.buildRequest()
.post(identityProviderBase);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewIdentityProviderBase()
displayName := "Login with Amazon"
requestBody.SetDisplayName(&displayName)
requestBody.SetAdditionalData(map[string]interface{}{
"@odata.type": "microsoft.graph.socialIdentityProvider",
"identityProviderType": "Amazon",
"clientId": "56433757-cadd-4135-8431-2c9e3fd68ae8",
"clientSecret": "000000000000",
}
result, err := graphClient.Identity().IdentityProviders().Post(requestBody)
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
応答の例を次に示します。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.type": "microsoft.graph.socialIdentityProvider",
"id": "Amazon-OAUTH",
"displayName": "Login with Amazon",
"identityProviderType": "Amazon",
"clientId": "56433757-cadd-4135-8431-2c9e3fd68ae8",
"clientSecret": "000000000000"
}
例 2: Apple ID プロバイダーを取得します (B2C Azure ADのみ)
要求
要求の例を次に示します。
POST https://graph.microsoft.com/v1.0/identity/identityProviders
Content-type: application/json
{
"@odata.type": "microsoft.graph.appleManagedIdentityProvider",
"displayName": "Sign in with Apple",
"developerId": "UBF8T346G9",
"serviceId": "com.microsoft.rts.b2c.test.client",
"keyId": "99P6D879C4",
"certificateData": "******"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var identityProviderBase = new AppleManagedIdentityProvider
{
DisplayName = "Sign in with Apple",
DeveloperId = "UBF8T346G9",
ServiceId = "com.microsoft.rts.b2c.test.client",
KeyId = "99P6D879C4",
CertificateData = "******"
};
await graphClient.Identity.IdentityProviders
.Request()
.AddAsync(identityProviderBase);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': 'microsoft.graph.appleManagedIdentityProvider',
displayName: 'Sign in with Apple',
developerId: 'UBF8T346G9',
serviceId: 'com.microsoft.rts.b2c.test.client',
keyId: '99P6D879C4',
certificateData: '******'
};
await client.api('/identity/identityProviders')
.post(identityProviderBase);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/identity/identityProviders"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphIdentityProviderBase *identityProviderBase = [[MSGraphIdentityProviderBase alloc] init];
[identityProviderBase setDisplayName:@"Sign in with Apple"];
[identityProviderBase setDeveloperId:@"UBF8T346G9"];
[identityProviderBase setServiceId:@"com.microsoft.rts.b2c.test.client"];
[identityProviderBase setKeyId:@"99P6D879C4"];
[identityProviderBase setCertificateData:@"******"];
NSError *error;
NSData *identityProviderBaseData = [identityProviderBase getSerializedDataWithError:&error];
[urlRequest setHTTPBody:identityProviderBaseData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
AppleManagedIdentityProvider identityProviderBase = new AppleManagedIdentityProvider();
identityProviderBase.displayName = "Sign in with Apple";
identityProviderBase.developerId = "UBF8T346G9";
identityProviderBase.serviceId = "com.microsoft.rts.b2c.test.client";
identityProviderBase.keyId = "99P6D879C4";
identityProviderBase.certificateData = "******";
graphClient.identity().identityProviders()
.buildRequest()
.post(identityProviderBase);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewIdentityProviderBase()
displayName := "Sign in with Apple"
requestBody.SetDisplayName(&displayName)
requestBody.SetAdditionalData(map[string]interface{}{
"@odata.type": "microsoft.graph.appleManagedIdentityProvider",
"developerId": "UBF8T346G9",
"serviceId": "com.microsoft.rts.b2c.test.client",
"keyId": "99P6D879C4",
"certificateData": "******",
}
result, err := graphClient.Identity().IdentityProviders().Post(requestBody)
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
応答の例を次に示します。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.type": "microsoft.graph.appleManagedIdentityProvider",
"id": "Apple-Managed-OIDC",
"displayName": "Sign in with Apple",
"developerId": "UBF8T346G9",
"serviceId": "com.microsoft.rts.b2c.test.client",
"keyId": "99P6D879C4",
"certificateData": "******"
}