命名空间:microsoft.graph
更新租户中配置的指定标识提供者的属性。
在派生自 identityProviderBase 的提供程序类型中,当前可以在 Microsoft Entra ID 中更新 socialIdentityProvider 资源。 在 Azure AD B2C 中,此操作当前可以更新 socialIdentityProvider 或 appleManagedIdentityProvider 资源。
此 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. 必需。 |
请求正文
在请求正文中,为 JSON 对象提供一个或多个属性,这些属性需要为 Microsoft Entra租户中的 socialIdentityProvider 对象更新。
在 Azure AD B2C 中,为 JSON 对象提供一个或多个属性,这些属性需要针对 socialIdentityProvider 或 appleManagedIdentityProvider 对象进行更新。
socialIdentityProvider 对象
属性 |
类型 |
说明 |
clientId |
字符串 |
向标识提供者注册应用程序时获取的客户端应用程序的标识符。 |
clientSecret |
字符串 |
向标识提供程序注册时获取的应用程序的客户端密码。 这是只读的。 读取操作返回 **** 。 |
displayName |
字符串 |
标识提供程序的显示名称。 |
appleManagedIdentityProvider 对象
属性 |
类型 |
说明 |
displayName |
字符串 |
标识提供程序的显示名称。 |
developerId |
String |
Apple 开发人员标识符。 |
服务 Id |
String |
Apple 服务标识符。 |
keyId |
String |
Apple 密钥标识符。 |
certificateData |
String |
证书中长文本字符串的证书数据可能是 null。 |
响应
如果成功,此方法返回 204 No Content
响应代码。 如果失败,将返回 4xx
错误并显示具体详细信息。
示例
示例 1:更新特定社交标识提供者 (Microsoft Entra ID 或 Azure AD B2C)
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/v1.0/identity/identityProviders/Amazon-OAUTH
Content-type: application/json
{
"@odata.type": "#microsoft.graph.socialIdentityProvider",
"clientSecret": "1111111111111"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new SocialIdentityProvider
{
OdataType = "#microsoft.graph.socialIdentityProvider",
ClientSecret = "1111111111111",
};
// 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);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc identity identity-providers patch --identity-provider-base-id {identityProviderBase-id} --body '{\
"@odata.type": "#microsoft.graph.socialIdentityProvider",\
"clientSecret": "1111111111111"\
}\
'
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewIdentityProviderBase()
clientSecret := "1111111111111"
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)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// 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("1111111111111");
IdentityProviderBase result = graphClient.identity().identityProviders().byIdentityProviderBaseId("{identityProviderBase-id}").patch(identityProviderBase);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const identityProviderBase = {
'@odata.type': '#microsoft.graph.socialIdentityProvider',
clientSecret: '1111111111111'
};
await client.api('/identity/identityProviders/Amazon-OAUTH')
.update(identityProviderBase);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\SocialIdentityProvider;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new SocialIdentityProvider();
$requestBody->setOdataType('#microsoft.graph.socialIdentityProvider');
$requestBody->setClientSecret('1111111111111');
$result = $graphServiceClient->identity()->identityProviders()->byIdentityProviderBaseId('identityProviderBase-id')->patch($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.socialIdentityProvider"
clientSecret = "1111111111111"
}
Update-MgIdentityProvider -IdentityProviderBaseId $identityProviderBaseId -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.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 = "1111111111111",
)
result = await graph_client.identity.identity_providers.by_identity_provider_base_id('identityProviderBase-id').patch(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
HTTP/1.1 204 No Content
示例 2:仅针对 Azure AD B2C (更新特定的 Apple 标识提供者)
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/v1.0/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.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);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc identity identity-providers patch --identity-provider-base-id {identityProviderBase-id} --body '{\
"@odata.type": "#microsoft.graph.socialIdentityProvider",\
"displayName": "Apple"\
}\
'
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-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)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// 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);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
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')
.update(identityProviderBase);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\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();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.socialIdentityProvider"
displayName = "Apple"
}
Update-MgIdentityProvider -IdentityProviderBaseId $identityProviderBaseId -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.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)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
以下示例显示了相应的响应。
HTTP/1.1 204 No Content