Azure user.memberof

问题描述 投票:0回答:1

我正在尝试创建一个具有动态成员资格规则的动态组,该规则添加不属于另一个组的用户。

所以基于文档

user.memberof -any (group.objectId -in ['my-group-id'])
有效,但我正在尝试修改它。
-not (user.memberof -any (group.objectId -in ['my-group-id'])
已尝试过此操作,但会给出无效的属性,如果我修改
(group.objectId -not ['my-group-id'])
给出无效的操作数,同样如此。

azure azure-active-directory entra azure-entra-id
1个回答
0
投票

正如这个MS Document中提到的,有一个限制说:

memberOf 属性不能与其他运算符一起使用。例如,您无法创建声明 “组 A 的成员不能属于动态组 B”的规则。

我有一个使用动态查询创建的组

user.department -eq "IT"
拥有以下用户作为成员:

enter image description here

现在,我通过使用此动态查询包含上述组的相同成员来创建新的动态组

user.memberof -any (group.objectId -in ['above-group-id'])

enter image description here

当我尝试修改动态查询以排除另一个组中存在的成员时,我也遇到了相同的错误,如下所示:

-not (user.memberof -any (group.objectId -in ['my-group-id']))

enter image description here

user.memberof -any (group.objectId -not ['my-group-id'])

enter image description here

因此,在使用 memberOf 属性创建动态组时,不可能排除特定组的成员。

或者,您可以根据用户的属性(如部门、公司名称、职务、城市、国家等)过滤用户...

当我根据用户属性将动态查询修改为

user.department -ne "IT"
时,它起作用了:

enter image description here

为了确认,我检查了来自

DemoGrp01
的用户已成功排除的群组成员,如下所示:

enter image description here

参考: 根据组成员资格从动态组中排除用户 - Microsoft 问答,作者:Aaron Gill

© www.soinside.com 2019 - 2024. All rights reserved.