列出嵌套 Azure AD 组中的成员

List members from nested Azure AD group

我有一个 Azure AD 组,"All-Team"。那又分为三组:

  1. SrMgr_E3
  2. 指导
  3. Sachbearbeiter

每个组都有一个成员列表,我想从组中获取成员。

下面的命令给出了组列表,但我希望它给出所有组的成员列表。我假设 Azure AD 是一个平面结构,它会列出组中的所有成员(嵌套包括在内)。

$group_objectid = (Get-AzureADGroup -SearchString 'All-Team').objectid
Get-AzureADGroupMember -ObjectId $group_objectid

上面的命令将给我三个组的列表,但我想要该组中所有成员的列表。有执行此操作的命令吗?

没有这样的命令,list members操作是不可传递的,你的选择是使用循环:

$group_objectid = (Get-AzureADGroup -SearchString 'joytestg').ObjectId
$group2_objectid = (Get-AzureADGroupMember -ObjectId $group_objectid).ObjectId
foreach($item in $group2_objectid){
    Get-AzureADGroupMember -ObjectId $item
}