POST https://graph.microsoft.com/beta/identityProviders
Content-type: application/json
{
"@odata.type": "microsoft.graph.identityProvider",
"name": "Login with Amazon",
"type": "Amazon",
"clientId": "56433757-cadd-4135-8431-2c9e3fd68ae8",
"clientSecret": "000000000000"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new IdentityProvider
{
OdataType = "microsoft.graph.identityProvider",
Name = "Login with Amazon",
Type = "Amazon",
ClientId = "56433757-cadd-4135-8431-2c9e3fd68ae8",
ClientSecret = "000000000000",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityProviders.PostAsync(requestBody);
// 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.NewIdentityProvider()
name := "Login with Amazon"
requestBody.SetName(&name)
type := "Amazon"
requestBody.SetType(&type)
clientId := "56433757-cadd-4135-8431-2c9e3fd68ae8"
requestBody.SetClientId(&clientId)
clientSecret := "000000000000"
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.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);
IdentityProvider identityProvider = new IdentityProvider();
identityProvider.setOdataType("microsoft.graph.identityProvider");
identityProvider.setName("Login with Amazon");
identityProvider.setType("Amazon");
identityProvider.setClientId("56433757-cadd-4135-8431-2c9e3fd68ae8");
identityProvider.setClientSecret("000000000000");
IdentityProvider result = graphClient.identityProviders().post(identityProvider);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\IdentityProvider;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new IdentityProvider();
$requestBody->setOdataType('microsoft.graph.identityProvider');
$requestBody->setName('Login with Amazon');
$requestBody->setType('Amazon');
$requestBody->setClientId('56433757-cadd-4135-8431-2c9e3fd68ae8');
$requestBody->setClientSecret('000000000000');
$result = $graphServiceClient->identityProviders()->post($requestBody)->wait();
# 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 import IdentityProvider
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = IdentityProvider(
odata_type = "microsoft.graph.identityProvider",
name = "Login with Amazon",
type = "Amazon",
client_id = "56433757-cadd-4135-8431-2c9e3fd68ae8",
client_secret = "000000000000",
)
result = await graph_client.identity_providers.post(request_body)
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new OpenIdConnectProvider
{
OdataType = "microsoft.graph.openIdConnectProvider",
Name = "Login with the Contoso identity provider",
Type = "OpenIDConnect",
ClientId = "56433757-cadd-4135-8431-2c9e3fd68ae8",
ClientSecret = "12345",
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.IdentityProviders.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OpenIdConnectProvider identityProvider = new OpenIdConnectProvider();
identityProvider.setOdataType("microsoft.graph.openIdConnectProvider");
identityProvider.setName("Login with the Contoso identity provider");
identityProvider.setType("OpenIDConnect");
identityProvider.setClientId("56433757-cadd-4135-8431-2c9e3fd68ae8");
identityProvider.setClientSecret("12345");
ClaimsMapping claimsMapping = new ClaimsMapping();
claimsMapping.setUserId("myUserId");
claimsMapping.setGivenName("myGivenName");
claimsMapping.setSurname("mySurname");
claimsMapping.setEmail("myEmail");
claimsMapping.setDisplayName("myDisplayName");
identityProvider.setClaimsMapping(claimsMapping);
identityProvider.setDomainHint("mycustomoidc");
identityProvider.setMetadataUrl("https://mycustomoidc.com/.well-known/openid-configuration");
identityProvider.setResponseMode(OpenIdConnectResponseMode.Form_post);
identityProvider.setResponseType(EnumSet.of(OpenIdConnectResponseTypes.Code));
identityProvider.setScope("openid");
IdentityProvider result = graphClient.identityProviders().post(identityProvider);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\OpenIdConnectProvider;
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 OpenIdConnectProvider();
$requestBody->setOdataType('microsoft.graph.openIdConnectProvider');
$requestBody->setName('Login with the Contoso identity provider');
$requestBody->setType('OpenIDConnect');
$requestBody->setClientId('56433757-cadd-4135-8431-2c9e3fd68ae8');
$requestBody->setClientSecret('12345');
$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->identityProviders()->post($requestBody)->wait();
# 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_provider import OpenIdConnectProvider
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 = OpenIdConnectProvider(
odata_type = "microsoft.graph.openIdConnectProvider",
name = "Login with the Contoso identity provider",
type = "OpenIDConnect",
client_id = "56433757-cadd-4135-8431-2c9e3fd68ae8",
client_secret = "12345",
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_providers.post(request_body)