命名空间: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 对象,其中包含需要为 socialIdentityProvider appleManagedIdentityProvider 或 oidcIdentityProvider 对象更新的一个或多个属性。
在 Azure AD B2C 中,为请求正文的 JSON 对象提供一个或多个属性,这些属性需要针对 socialIdentityProvider、appleManagedIdentityProvider 或 openIdConnectIdentityProvider 对象进行更新。
socialIdentityProvider 对象
| 属性 |
类型 |
说明 |
| clientId |
字符串 |
向标识提供程序注册应用程序时,获取应用程序的客户端标识符。 |
| clientSecret |
字符串 |
向标识提供程序注册时获取的应用程序的客户端密码。 这是只读的。 读取操作返回 ****。 |
| displayName |
字符串 |
标识提供程序的显示名称。 |
| identityProviderType |
String |
对于外部租户和员工租户,可能的值为: Facebook, Google. 对于 Azure AD B2C 租户,可能的值为:Microsoft、、Google、 Amazon领英FacebookGitHubTwitterWeiboQQWeChat |
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 responseType,则不需要机密,因为身份验证管道中没有代码交换。 在此模式下,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_tokentoken。 |
| 范围 |
String |
范围定义要从自定义标识提供程序收集的信息和权限。 |
oidcIdentityProvider 对象
| 属性 |
类型 |
说明 |
| clientAuthentication |
clientAuthentication |
客户端身份验证设置。 使用 oidcClientSecretAuthentication 类型通过 OR 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 是使用 https 方案的区分大小写的 URL,包含方案、主机以及端口号和路径组件(可选),不含查询或片段组件。
注意:目前不支持将其他 Microsoft Entra 租户配置为外部标识提供者。 因此, microsoftonline.com 不接受颁发者 URI 中的域。 |
| responseType |
String |
响应类型描述在对自定义标识提供程序的authorization_endpoint的初始调用中发回的信息类型。 可能值: code 、、 id_tokentoken。 |
| 范围 |
String |
范围定义要从自定义标识提供程序收集的信息和权限。 |
| wellKnownEndpoint |
String |
OpenID Connect 标识提供程序的元数据文档的 URL。 每个 OpenID Connect 标识提供程序都描述一个元数据文档,其中包含执行登录所需的大多数信息。 这包括要使用的 URL 和服务的公共签名密钥的位置等信息。 OpenID Connect 元数据文档始终位于以 结 .well-known/openid-configuration尾的终结点。
注意:元数据文档至少应包含以下属性:issuer、response_types_supportedjwks_uriauthorization_endpointtoken_endpointtoken_endpoint_auth_methods_supportedsubject_types_supported和。 有关更多详细信息,请访问 OpenID Connect Discovery 规范。 |
响应
如果成功,此方法返回 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);
// 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);
// 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:更新 OpenID Connect 标识提供程序 (Azure AD B2C 租户)
请求
以下示例显示了一个请求。
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);
// 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);
// 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