命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新租户中配置的指定外部标识提供者的属性。
在派生自 identityProviderBase 的提供程序类型中,在 Microsoft Entra 中,此操作可以更新 socialIdentityProvider、appleManagedIdentityProvider (仅) 外部租户,或者仅更新外部租户) 资源的 oidcIdentityProvider (外部租户。
在 Azure AD B2C 中,此操作可以更新 socialIdentityProvider、 appleManagedIdentityProvider、 builtinIdentityProvider 或 openIdConnectIdentityProvider 资源。
此 API 可用于以下国家级云部署。
全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
✅ |
✅ |
✅ |
✅ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 |
最低特权权限 |
更高特权权限 |
委派(工作或学校帐户) |
IdentityProvider.ReadWrite.All |
不可用。 |
委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
应用程序 |
IdentityProvider.ReadWrite.All |
不可用。 |
重要
在具有工作或学校帐户的委托方案中,必须为登录用户分配受支持的Microsoft Entra角色或具有支持的角色权限的自定义角色。
外部标识提供者管理员 是此操作支持的最低特权角色。
HTTP 请求
PATCH /identity/identityProviders/{id}
名称 |
说明 |
Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
Content-Type |
application/json. 必需。 |
请求正文
在 Microsoft Entra 外部 ID中,为请求正文提供一个或多个属性的 JSON 对象,这些属性需要针对 socialIdentityProviderappleManagedIdentityProvider 或 oidcIdentityProvider 对象进行更新。
在 Azure AD B2C 中,为请求正文提供一个或多个属性的 JSON 对象,这些属性需要针对 socialIdentityProvider、 appleManagedIdentityProvider 或 openIdConnectIdentityProvider 对象进行更新。
socialIdentityProvider 对象
属性 |
类型 |
说明 |
clientId |
字符串 |
向标识提供程序注册应用程序时,获取应用程序的客户端标识符。 |
clientSecret |
字符串 |
向标识提供程序注册时获取的应用程序的客户端密码。 这是只读的。 读取操作返回 **** 。 |
displayName |
字符串 |
标识提供程序的显示名称。 |
identityProviderType |
String |
对于外部租户和劳动力租户,可能的值: Facebook 、 Google 。 对于 Azure AD B2C 租户,可能的值:Microsoft 、、Google 、Amazon 、Facebook GitHub LinkedIn 、Weibo Twitter 、、 。 WeChat QQ |
appleManagedIdentityProvider 对象
属性 |
类型 |
说明 |
certificateData |
String |
证书中长文本字符串的证书数据可能是 null。 |
developerId |
String |
Apple 开发人员标识符。 |
displayName |
字符串 |
标识提供程序的显示名称。 |
keyId |
String |
Apple 密钥标识符。 |
服务 Id |
String |
Apple 服务标识符。 |
openIdConnectIdentityProvider 对象
属性 |
类型 |
说明 |
claimsMapping |
claimsMapping |
在 OIDC 提供程序将 ID 令牌发送回Microsoft Entra ID后,Microsoft Entra ID需要能够将收到的令牌中的声明映射到Microsoft Entra ID识别和使用的声明。 此复杂类型捕获该映射。 |
clientId |
字符串 |
向标识提供程序注册应用程序时,获取应用程序的客户端标识符。 |
clientSecret |
字符串 |
使用身份提供程序注册应用时获取的应用客户端密码。 clientSecret 依赖于 responseType。 - 当 responseType 为
code 时,身份验证代码交换需要机密。 - 当 responseType 为
id_token 时,不需要机密,因为身份验证管道中没有代码交换。 在此模式下,id_token直接从授权响应返回。
|
displayName |
字符串 |
标识提供程序的显示名称。 |
domainHint |
String |
域提示可用于直接跳到指定标识提供者的登录页,而不是让用户在可用标识提供者列表中做出选择。 |
metadataUrl |
String |
OpenID Connect 标识提供者的元数据文档的 URL。 每个 OpenID Connect 标识提供者都描述了一个元数据文档,其中包含执行登录所需的大部分信息。 这包括要使用的 URL 和服务公共签名密钥的位置等信息。 OpenID Connect 元数据文档始终位于 以 结尾的终结点。.well-known/openid-configuration 提供添加的 OpenID Connect 标识提供者的元数据 URL。 |
responseMode |
String |
响应模式定义用于将数据从自定义标识提供者发送回 Azure AD B2C 的方法。 可能的值: form_post 、 query 。 |
responseType |
String |
响应类型描述在初始调用中发送回自定义标识提供者authorization_endpoint的信息的类型。 可能的值: code 、 id_token 、 token 。 |
范围 |
String |
作用域定义要从自定义标识提供者收集的信息和权限。 |
oidcIdentityProvider 对象
属性 |
类型 |
说明 |
clientAuthentication |
clientAuthentication |
客户端身份验证设置。 使用 oidcClientSecretAuthentication 类型通过 或 client_secret_jwt authentication 方法设置标识提供者client_secret_post 。 使用 oidcPrivateJwtKeyClientAuthentication 类型通过身份验证方法设置标识提供者 private_key_jwt 。 出于安全原因, client_secret_basic 不支持身份验证方法。 |
clientId |
字符串 |
使用身份提供程序注册应用时获取的应用客户端 ID。 |
displayName |
字符串 |
标识提供程序的显示名称。 |
inboundclaimMapping |
inboundclaimMapping |
OIDC 提供程序将 ID 令牌发送回Microsoft Entra 外部 ID后,Microsoft Entra 外部 ID需要能够将收到的令牌中的声明映射到Microsoft Entra ID识别和使用的声明。 此复杂类型捕获该映射。 |
发行 |
String |
颁发者 URI。 颁发者 URI 是一个区分大小写的 URL,使用 https 方案包含方案、主机和(可选)端口号和路径组件,并且没有查询或片段组件。
注意:目前不支持将其他Microsoft Entra租户配置为外部标识提供者。 因此, microsoftonline.com 不接受颁发者 URI 中的域。 |
responseType |
String |
响应类型描述在初始调用中发送回自定义标识提供者authorization_endpoint的信息的类型。 可能的值: code 、 id_token 、 token 。 |
范围 |
String |
作用域定义要从自定义标识提供者收集的信息和权限。 |
wellKnownEndpoint |
String |
OpenID Connect 标识提供者的元数据文档的 URL。 每个 OpenID Connect 标识提供者都描述了一个元数据文档,其中包含执行登录所需的大部分信息。 这包括要使用的 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 发现 规范。 |
响应
如果成功,此方法返回 204 No Content
响应代码。 如果失败,将返回 4xx
错误并显示具体详细信息。
示例
示例 1:更新 社交标识提供者
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/beta/identity/identityProviders/Amazon-OAUTH
Content-type: application/json
{
"@odata.type": "#microsoft.graph.socialIdentityProvider",
"clientSecret": "4294967296"
}
// 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",
ClientSecret = "4294967296",
};
// 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["{identityProviderBase-id}"].PatchAsync(requestBody);
mgc-beta identity identity-providers patch --identity-provider-base-id {identityProviderBase-id} --body '{\
"@odata.type": "#microsoft.graph.socialIdentityProvider",\
"clientSecret": "4294967296"\
}\
'
// 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()
clientSecret := "4294967296"
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().ByIdentityProviderBaseId("identityProviderBase-id").Patch(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.setClientSecret("4294967296");
IdentityProviderBase result = graphClient.identity().identityProviders().byIdentityProviderBaseId("{identityProviderBase-id}").patch(identityProviderBase);
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': '#microsoft.graph.socialIdentityProvider',
clientSecret: '4294967296'
};
await client.api('/identity/identityProviders/Amazon-OAUTH')
.version('beta')
.update(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->setClientSecret('4294967296');
$result = $graphServiceClient->identity()->identityProviders()->byIdentityProviderBaseId('identityProviderBase-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.socialIdentityProvider"
clientSecret = "4294967296"
}
Update-MgBetaIdentityProvider -IdentityProviderBaseId $identityProviderBaseId -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",
client_secret = "4294967296",
)
result = await graph_client.identity.identity_providers.by_identity_provider_base_id('identityProviderBase-id').patch(request_body)
响应
以下示例显示了相应的响应。
HTTP/1.1 204 No Content
示例 2:更新 Apple 标识提供者
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/beta/identity/identityProviders/Apple-Managed-OIDC
Content-type: application/json
{
"@odata.type": "#microsoft.graph.socialIdentityProvider",
"displayName": "Apple"
}
// 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 = "Apple",
};
// 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["{identityProviderBase-id}"].PatchAsync(requestBody);
mgc-beta identity identity-providers patch --identity-provider-base-id {identityProviderBase-id} --body '{\
"@odata.type": "#microsoft.graph.socialIdentityProvider",\
"displayName": "Apple"\
}\
'
// 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)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
identityProviders, err := graphClient.Identity().IdentityProviders().ByIdentityProviderBaseId("identityProviderBase-id").Patch(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("Apple");
IdentityProviderBase result = graphClient.identity().identityProviders().byIdentityProviderBaseId("{identityProviderBase-id}").patch(identityProviderBase);
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': '#microsoft.graph.socialIdentityProvider',
displayName: 'Apple'
};
await client.api('/identity/identityProviders/Apple-Managed-OIDC')
.version('beta')
.update(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('Apple');
$result = $graphServiceClient->identity()->identityProviders()->byIdentityProviderBaseId('identityProviderBase-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.socialIdentityProvider"
displayName = "Apple"
}
Update-MgBetaIdentityProvider -IdentityProviderBaseId $identityProviderBaseId -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 = "Apple",
)
result = await graph_client.identity.identity_providers.by_identity_provider_base_id('identityProviderBase-id').patch(request_body)
响应
以下示例显示了相应的响应。
HTTP/1.1 204 No Content
示例 3: (Azure AD B2C 租户更新 OpenID Connect 标识提供者)
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/beta/identity/identityProviders/Contoso-OIDC-00001111-aaaa-2222-bbbb-3333cccc4444
Content-type: application/json
{
"@odata.type": "#microsoft.graph.openIdConnectIdentityProvider",
"responseType": "id_token"
}
// 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",
ResponseType = OpenIdConnectResponseTypes.Id_token,
};
// 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["{identityProviderBase-id}"].PatchAsync(requestBody);
mgc-beta identity identity-providers patch --identity-provider-base-id {identityProviderBase-id} --body '{\
"@odata.type": "#microsoft.graph.openIdConnectIdentityProvider",\
"responseType": "id_token"\
}\
'
// 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()
responseType := graphmodels.ID_TOKEN_OPENIDCONNECTRESPONSETYPES
requestBody.SetResponseType(&responseType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
identityProviders, err := graphClient.Identity().IdentityProviders().ByIdentityProviderBaseId("identityProviderBase-id").Patch(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.setResponseType(EnumSet.of(OpenIdConnectResponseTypes.Id_token));
IdentityProviderBase result = graphClient.identity().identityProviders().byIdentityProviderBaseId("{identityProviderBase-id}").patch(identityProviderBase);
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': '#microsoft.graph.openIdConnectIdentityProvider',
responseType: 'id_token'
};
await client.api('/identity/identityProviders/Contoso-OIDC-00001111-aaaa-2222-bbbb-3333cccc4444')
.version('beta')
.update(identityProviderBase);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\OpenIdConnectIdentityProvider;
use Microsoft\Graph\Beta\Generated\Models\OpenIdConnectResponseTypes;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OpenIdConnectIdentityProvider();
$requestBody->setOdataType('#microsoft.graph.openIdConnectIdentityProvider');
$requestBody->setResponseType(new OpenIdConnectResponseTypes('id_token'));
$result = $graphServiceClient->identity()->identityProviders()->byIdentityProviderBaseId('identityProviderBase-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.openIdConnectIdentityProvider"
responseType = "id_token"
}
Update-MgBetaIdentityProvider -IdentityProviderBaseId $identityProviderBaseId -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.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",
response_type = OpenIdConnectResponseTypes.Id_token,
)
result = await graph_client.identity.identity_providers.by_identity_provider_base_id('identityProviderBase-id').patch(request_body)
响应
以下示例显示了相应的响应。
HTTP/1.1 204 No Content
示例 4: (外部租户) 更新 OpenID Connect 标识提供者
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/beta/identity/identityProviders/ContosoOIDCIdentityProvider
Content-type: application/json
{
"@odata.type": "#microsoft.graph.oidcIdentityProvider",
"displayName": "Contoso"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new OidcIdentityProvider
{
OdataType = "#microsoft.graph.oidcIdentityProvider",
DisplayName = "Contoso",
};
// 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["{identityProviderBase-id}"].PatchAsync(requestBody);
mgc-beta identity identity-providers patch --identity-provider-base-id {identityProviderBase-id} --body '{\
"@odata.type": "#microsoft.graph.oidcIdentityProvider",\
"displayName": "Contoso"\
}\
'
// 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)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
identityProviders, err := graphClient.Identity().IdentityProviders().ByIdentityProviderBaseId("identityProviderBase-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OidcIdentityProvider identityProviderBase = new OidcIdentityProvider();
identityProviderBase.setOdataType("#microsoft.graph.oidcIdentityProvider");
identityProviderBase.setDisplayName("Contoso");
IdentityProviderBase result = graphClient.identity().identityProviders().byIdentityProviderBaseId("{identityProviderBase-id}").patch(identityProviderBase);
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': '#microsoft.graph.oidcIdentityProvider',
displayName: 'Contoso'
};
await client.api('/identity/identityProviders/ContosoOIDCIdentityProvider')
.version('beta')
.update(identityProviderBase);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\OidcIdentityProvider;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OidcIdentityProvider();
$requestBody->setOdataType('#microsoft.graph.oidcIdentityProvider');
$requestBody->setDisplayName('Contoso');
$result = $graphServiceClient->identity()->identityProviders()->byIdentityProviderBaseId('identityProviderBase-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.oidcIdentityProvider"
displayName = "Contoso"
}
Update-MgBetaIdentityProvider -IdentityProviderBaseId $identityProviderBaseId -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.oidc_identity_provider import OidcIdentityProvider
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OidcIdentityProvider(
odata_type = "#microsoft.graph.oidcIdentityProvider",
display_name = "Contoso",
)
result = await graph_client.identity.identity_providers.by_identity_provider_base_id('identityProviderBase-id').patch(request_body)
响应
以下示例显示了相应的响应。
HTTP/1.1 204 No Content