更新 unifiedRoleManagementAlertConfiguration
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新警报配置的属性。 警报配置可以是派生自 unifiedRoleManagementAlertConfiguration 对象的以下类型之一:
此 API 可用于以下国家级云部署 。
全局服务
美国政府 L4
美国政府 L5 (DOD)
由世纪互联运营的中国
✅
✅
✅
❌
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时 ,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型 。 要了解有关这些权限的详细信息,请参阅 权限参考 。
权限类型
最低特权权限
更高特权权限
委派(工作或学校帐户)
RoleManagementAlert.ReadWrite.Directory
不可用。
委派(个人 Microsoft 帐户)
不支持。
不支持。
应用程序
RoleManagementAlert.ReadWrite.Directory
不可用。
对于委托方案,还必须至少为调用用户分配特权角色管理员 Microsoft Entra角色 。
HTTP 请求
PATCH /identityGovernance/roleManagementAlerts/alertConfigurations/{unifiedRoleManagementAlertConfigurationId}
名称
说明
Authorization
持有者 {token}。 必填。 详细了解 身份验证和授权 。
Content-Type
application/json. 必需。
请求正文
在请求正文中,仅 提供应更新的属性的值。 请求正文中未包含的现有属性会保留其以前的值,或者根据对其他属性值的更改重新计算。
下表指定可更新的属性。
必须在请求正文中包含 @odata.type 属性。 此属性的值必须与要更新的派生警报配置类型相同。 例如,如果要更新 tooManyGlobalAdminsAssignedToTenantAlertConfiguration 警报配置, @odata.type 属性的值必须为 #microsoft.graph.tooManyGlobalAdminsAssignedToTenantAlertConfiguration 。
属性
类型
说明
duration
布尔值
从当前时间戳开始查看的天数。 可以针对 redundantAssignmentAlertConfiguration 和 staleSignInAlertConfiguration 警报配置类型进行更新。
globalAdminCountThreshold
Int32
租户中分配全局管理员角色的帐户数的阈值。 如果租户中的全局管理员数达到或超过此阈值,则触发警报。 可以针对 tooManyGlobalAdminsAssignedToTenantAlertConfiguration 警报配置类型进行更新。
isEnabled
Boolean
如果启用警报,则为 True。 将 设置为 false 将禁用对特定警报的扫描。 可选。 可针对所有警报配置类型进行更新。
percentageOfGlobalAdminsOutOfRolesThreshold
Int32
租户中所有角色分配中全局管理员百分比的阈值。 如果租户中的百分比达到或超过此阈值,则触发警报。 可以针对 tooManyGlobalAdminsAssignedToTenantAlertConfiguration 警报配置类型进行更新。
sequentialActivationCounterThreshold
Int32
timeIntervalBetweenActivations 期间触发警报的最小激活数。 可以针对 sequentialactivationrenewalsalertconfiguration 警报配置类型进行更新。
timeIntervalBetweenActivations
持续时间
激活触发警报的时间间隔。 可以针对 sequentialactivationrenewalsalertconfiguration 警报配置类型进行更新。
响应
如果成功,此方法返回 204 No Content
响应代码。
示例
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/beta/identityGovernance/roleManagementAlerts/alertConfigurations/DirectoryRole_67b47f38-0f0b-4e62-a3be-859140c2061f_TooManyGlobalAdminsAssignedToTenantAlert
Content-Type: application/json
{
"@odata.type":"#microsoft.graph.tooManyGlobalAdminsAssignedToTenantAlertConfiguration",
"isEnabled": "true",
"globalAdminCountThreshold": 7,
"percentageOfGlobalAdminsOutOfRolesThreshold": 70
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new TooManyGlobalAdminsAssignedToTenantAlertConfiguration
{
OdataType = "#microsoft.graph.tooManyGlobalAdminsAssignedToTenantAlertConfiguration",
IsEnabled = true,
GlobalAdminCountThreshold = 7,
PercentageOfGlobalAdminsOutOfRolesThreshold = 70,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.RoleManagementAlerts.AlertConfigurations["{unifiedRoleManagementAlertConfiguration-id}"].PatchAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta identity-governance role-management-alerts alert-configurations patch --unified-role-management-alert-configuration-id {unifiedRoleManagementAlertConfiguration-id} --body '{\
"@odata.type":"#microsoft.graph.tooManyGlobalAdminsAssignedToTenantAlertConfiguration",\
"isEnabled": "true",\
"globalAdminCountThreshold": 7,\
"percentageOfGlobalAdminsOutOfRolesThreshold": 70\
}\
'
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewUnifiedRoleManagementAlertConfiguration()
isEnabled := true
requestBody.SetIsEnabled(&isEnabled)
globalAdminCountThreshold := int32(7)
requestBody.SetGlobalAdminCountThreshold(&globalAdminCountThreshold)
percentageOfGlobalAdminsOutOfRolesThreshold := int32(70)
requestBody.SetPercentageOfGlobalAdminsOutOfRolesThreshold(&percentageOfGlobalAdminsOutOfRolesThreshold)
alertConfigurations, err := graphClient.IdentityGovernance().RoleManagementAlerts().AlertConfigurations().ByUnifiedRoleManagementAlertConfigurationId("unifiedRoleManagementAlertConfiguration-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);
TooManyGlobalAdminsAssignedToTenantAlertConfiguration unifiedRoleManagementAlertConfiguration = new TooManyGlobalAdminsAssignedToTenantAlertConfiguration();
unifiedRoleManagementAlertConfiguration.setOdataType("#microsoft.graph.tooManyGlobalAdminsAssignedToTenantAlertConfiguration");
unifiedRoleManagementAlertConfiguration.setIsEnabled(true);
unifiedRoleManagementAlertConfiguration.setGlobalAdminCountThreshold(7);
unifiedRoleManagementAlertConfiguration.setPercentageOfGlobalAdminsOutOfRolesThreshold(70);
UnifiedRoleManagementAlertConfiguration result = graphClient.identityGovernance().roleManagementAlerts().alertConfigurations().byUnifiedRoleManagementAlertConfigurationId("{unifiedRoleManagementAlertConfiguration-id}").patch(unifiedRoleManagementAlertConfiguration);
const options = {
authProvider,
};
const client = Client.init(options);
const unifiedRoleManagementAlertConfiguration = {
'@odata.type':'#microsoft.graph.tooManyGlobalAdminsAssignedToTenantAlertConfiguration',
isEnabled: 'true',
globalAdminCountThreshold: 7,
percentageOfGlobalAdminsOutOfRolesThreshold: 70
};
await client.api('/identityGovernance/roleManagementAlerts/alertConfigurations/DirectoryRole_67b47f38-0f0b-4e62-a3be-859140c2061f_TooManyGlobalAdminsAssignedToTenantAlert')
.version('beta')
.update(unifiedRoleManagementAlertConfiguration);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\TooManyGlobalAdminsAssignedToTenantAlertConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TooManyGlobalAdminsAssignedToTenantAlertConfiguration();
$requestBody->setOdataType('#microsoft.graph.tooManyGlobalAdminsAssignedToTenantAlertConfiguration');
$requestBody->setIsEnabled(true);
$requestBody->setGlobalAdminCountThreshold(7);
$requestBody->setPercentageOfGlobalAdminsOutOfRolesThreshold(70);
$result = $graphServiceClient->identityGovernance()->roleManagementAlerts()->alertConfigurations()->byUnifiedRoleManagementAlertConfigurationId('unifiedRoleManagementAlertConfiguration-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.Governance
$params = @{
"@odata.type" = "#microsoft.graph.tooManyGlobalAdminsAssignedToTenantAlertConfiguration"
isEnabled = "true"
globalAdminCountThreshold =
percentageOfGlobalAdminsOutOfRolesThreshold =
}
Update-MgBetaIdentityGovernanceRoleManagementAlertConfiguration -UnifiedRoleManagementAlertConfigurationId $unifiedRoleManagementAlertConfigurationId -BodyParameter $params
from msgraph import GraphServiceClient
from msgraph.generated.models.too_many_global_admins_assigned_to_tenant_alert_configuration import TooManyGlobalAdminsAssignedToTenantAlertConfiguration
graph_client = GraphServiceClient(credentials, scopes)
request_body = TooManyGlobalAdminsAssignedToTenantAlertConfiguration(
odata_type = "#microsoft.graph.tooManyGlobalAdminsAssignedToTenantAlertConfiguration",
is_enabled = True,
global_admin_count_threshold = 7,
percentage_of_global_admins_out_of_roles_threshold = 70,
)
result = await graph_client.identity_governance.role_management_alerts.alert_configurations.by_unified_role_management_alert_configuration_id('unifiedRoleManagementAlertConfiguration-id').patch(request_body)
响应
以下示例显示了相应的响应。
HTTP/1.1 204 No Content