简体   繁体   English

LDAP 查询以获取 AD 组中的成员列表

[英]LDAP query to get list of members in an AD group

I checked a few posts asked the similar questions before, but none works for my case, not sure if something wrong on my side or it's the AD.我之前查过几个帖子问过类似的问题,但没有一个适用于我的情况,不确定是我这边有问题还是广告。

So I have security group at path:所以我在路径上有安全组:

CN=MigratedUsers,OU=Azure Groups,OU=Security Groups,OU=National Organization,DC=abc,DC=firm,AD

And in the MigratedUsers group, there is a member property with a few AD users in the group.在 MigratedUsers 组中,有一个成员属性,组中有几个 AD 用户。 I am trying to get the list of users, so I can iterate through them.我正在尝试获取用户列表,因此我可以遍历它们。

So in my base location I specified:所以在我的基本位置我指定:

OU=Azure Groups,OU=Security Groups,OU=National Organization,DC=abc,DC=firm

For the LDAP Filter I have:对于 LDAP 过滤器,我有:

(&(objectCategory=user)(memberOf=CN=MigratedUsers,OU=Azure Groups,OU=Security Groups,OU=National Organization,DC=abc,DC=firm))

The result returned 0 records.结果返回0条记录。

I tried other combinations such as (&(objectCategory=group)(CN=MigratedUsers)) , it doesn't work either.我尝试了其他组合,例如(&(objectCategory=group)(CN=MigratedUsers)) ,它也不起作用。

So, could anyone point out to me if anything in my query is wrong or I need to start checking something else like AD settings etc.因此,如果我的查询中有任何错误或我需要开始检查其他内容(例如 AD 设置等),谁能指出我的意见。

Thank you.谢谢你。

You're searching for users, but you set the base of the search to:您正在搜索用户,但将搜索的基础设置为:

OU=Azure Groups,OU=Security Groups,OU=National Organization,DC=abc,DC=firm

That tells it to only return users that are in the Azure Groups OU.这告诉它只返回Azure Groups OU 中的用户。 I'm guessing that there are no users in that OU.我猜该 OU 中没有用户。 Set the base of the search to the root of the domain (eg DC=abc,DC=firm ), or just don't set it at all, since that will be the default.将搜索的基础设置为域的根(例如DC=abc,DC=firm ),或者根本不设置它,因为这将是默认设置。

Your first filter is the correct one (which has the full DN of the group).您的第一个过滤器是正确的(具有组的完整 DN)。

Your first filter looks fine:你的第一个过滤器看起来不错:

(&(objectCategory=user)(memberOf=CN=MigratedUsers,OU=Azure Groups,OU=Security Groups,OU=National Organization,DC=abc,DC=firm))

But the search base is not, (it's a group search base, while you want to retrieve user entries).但是搜索库不是,(它是一个组搜索库,而您想要检索用户条目)。 The user base should look like this:用户群应该是这样的:

OU=Users,OU=National Organization,DC=abc,DC=firm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM