| title | Create identityProvider |
|---|---|
| description | Create a new identityProvider object. |
| ms.localizationpriority | medium |
| doc_type | apiPageType |
| author | brozbab |
| ms.subservice | entra-sign-in |
| ms.date | 11/16/2024 |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Create an identity provider object that is of the type specified in the request body.
Among the types of providers derived from identityProviderBase, in Microsoft Entra, this operation can create a socialIdentityProvider, appleManagedIdentityProvider (external tenant only), or an oidcIdentityProvider (external tenant only) resource.
In Azure AD B2C, this operation can create a socialIdentityProvider, appleManagedIdentityProvider, builtinIdentityProvider, or an openIdConnectIdentityProvider resource.
[!INCLUDE national-cloud-support]
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
[!INCLUDE rbac-identity-provider-apis]
POST /identity/identityProviders| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
In the request body, provide a JSON representation of socialIdentityProvider, oidcIdentityProvider, or an appleManagedIdentityProvider object in Microsoft Entra External ID.
In Azure AD B2C provide a JSON representation of socialIdentityProvider, openIdConnectIdentityProvider, or an appleManagedIdentityProvider object.
All the properties listed in the following tables are required.
| Property | Type | Description |
|---|---|---|
| displayName | String | The display name of the identity provider. |
| clientId | String | The client identifier for the application obtained when registering the application with the identity provider. |
| clientSecret | String | The client secret for the application that is obtained when the application is registered with the identity provider. This is write-only. A read operation returns ****. |
| identityProviderType | String | For external and workforce tenants, possible values: Facebook, Google.For Azure AD B2C tenants, possible values: Microsoft, Google, Amazon, LinkedIn, Facebook, GitHub, Twitter, Weibo, QQ, WeChat. |
| Property | Type | Description |
|---|---|---|
| displayName | String | The display name of the identity provider. |
| developerId | String | The Apple developer identifier. |
| serviceId | String | The Apple service identifier. |
| keyId | String | The Apple key identifier. |
| certificateData | String | The certificate data which is a long string of text from the certificate, can be null. |
| Property | Type | Description |
|---|---|---|
| displayName | String | The display name of the identity provider. |
| clientId | String | The client identifier for the application obtained when registering the application with the identity provider. |
| clientSecret | String | The client secret for the application obtained when registering the application with the identity provider. The clientSecret has a dependency on responseType.
|
| domainHint | String | The domain hint can be used to skip directly to the sign in page of the specified identity provider, instead of having the user make a selection among the list of available identity providers. |
| claimsMapping | claimsMapping | After the OIDC provider sends an ID token back to Microsoft Entra ID, Microsoft Entra ID needs to be able to map the claims from the received token to the claims that Microsoft Entra ID recognizes and uses. This complex type captures that mapping. |
| metadataUrl | String | The URL for the metadata document of the OpenID Connect identity provider. Every OpenID Connect identity provider describes a metadata document that contains most of the information required to perform sign-in. This includes information such as the URLs to use and the location of the service's public signing keys. The OpenID Connect metadata document is always located at an endpoint that ends in .well-known/openid-configuration. Provide the metadata URL for the OpenID Connect identity provider you add. |
| responseMode | String | The response mode defines the method used to send data back from the custom identity provider to Azure AD B2C. Possible values: form_post, query. |
| responseType | String | The response type describes the type of information sent back in the initial call to the authorization_endpoint of the custom identity provider. Possible values: code , id_token , token. |
| scope | String | Scope defines the information and permissions you are looking to gather from your custom identity provider. |
| Property | Type | Description |
|---|---|---|
| clientAuthentication | oidcClientAuthentication | The client authentication settings.client_secret_post or client_secret_jwt authentication methods. private_key_jwt authentication method. Due to security reasons, client_secret_basic authentication method isn't supported. |
| clientId | String | The client ID for the application obtained when registering the application with the identity provider. |
| displayName | String | The display name of the identity provider. Inherited from identityProviderBase. |
| id | String | The identifier of the identity provider.Required. Inherited from identityProviderBase. Inherits from entity |
| inboundClaimMapping | oidcInboundClaimMappingOverride | After the OIDC provider sends an ID token back to Microsoft Entra External ID, Microsoft Entra External ID needs to be able to map the claims from the received token to the claims that Microsoft Entra ID recognizes and uses. This complex type captures that mapping. |
| issuer | String | The issuer URI. Issuer URI is a case-sensitive URL using https scheme contains scheme, host, and optionally, port number and path components and no query or fragment components. Note: Configuring other Microsoft Entra tenants as an external identity provider is currently not supported. As a result, the microsoftonline.com domain in the issuer URI is not accepted. |
| responseType | oidcResponseType | The response type describes the type of information sent back in the initial call to the authorization_endpoint of the custom identity provider. Possible values: code: As per the authorization code flow, a code is returned back to Entra External ID. Entra External ID proceeds to call the token_endpoint to exchange the code for the token.id_token: An ID token is returned back to Entra External ID from the custom identity provider. (This value is not supported at the moment).token: An access token is returned back to Entra External ID from the custom identity provider. This value is currently unsupported. |
| scope | String | Scope defines the information and permissions you are looking to gather from your custom identity provider. |
| wellKnownEndpoint | String | The URL for the metadata document of the OpenID Connect identity provider. Every OpenID Connect identity provider describes a metadata document that contains most of the information required to perform sign-in. This includes information such as the URLs to use and the location of the service's public signing keys. The OpenID Connect metadata document is always located at an endpoint that ends in .well-known/openid-configuration.Note: The metadata document should, at minimum, contain the following properties: issuer, authorization_endpoint, token_endpoint, token_endpoint_auth_methods_supported, response_types_supported, subject_types_supported and jwks_uri. Visit OpenID Connect Discovery specifications for more details. |
If successful, this method returns a 201 Created response code and a JSON representation of a socialIdentityProvider object in the response body for a Microsoft Entra tenant.
For an Azure AD B2C tenant, this method returns a 201 Created response code and a JSON representation of a socialIdentityProvider, openIdConnectIdentityProvider, or an appleManagedIdentityProvider object in the response body.
If unsuccessful, a 4xx error will be returned with specific details.
The following example shows a request.
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"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
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"
}The following example shows a request.
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": "******"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
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": "******"
}The following example shows a request.
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"
}
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
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"
}The following example shows a request.
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"
}
}
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
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"
}
}
}