通过Powershell导出Azure广告组成员身份 [英] Export azure ad groups membership via powershell

查看:62
本文介绍了通过Powershell导出Azure广告组成员身份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要Powershell脚本中的帮助.我正在寻找Azure AD,CSV文件中多个组的组成员身份详细信息.

I need help in the powershell script. I am looking to get Azure AD, group membership details for multiple groups which are in the CSV file.

我希望获得的格式是:

组名:SG-Test-Users
成员:xyz,abc等

Group Name :SG-Test-Users
Members: xyz, abc etc

需要此格式的输出

请帮助

我在下面的脚本中尝试过,但是它没有提供我想要的格式的输出.

I tried, below script but it is not giving an output in the format I am looking for.

Import-Csv -Path "C:\temp\testgroup.csv" | ForEach-Object {Get-AzureADGroupMember -ObjectId $_.name | select displayname,userprincipalname} | Export-Csv -Path "c:\temp\outputfile1.csv" -NoTypeInformation

谢谢

推荐答案

$ResourceAuditArray = @()
ForEach ($g in Get-AzureADGroup -SearchString "<first word of groups e.g. DFC, ADF, DAS>"){ 
    $ResourceAuditArray += Get-AzureADGroupMember -ObjectId $g.ObjectId -All $true  | Select-Object ObjectId, ObjectType, UserType, UserPrincipalName, @{n="DisplayName"; e={$g.DisplayName}}
} 

$ResourceAuditArray | Export-Csv  "<AAD Users list>.Csv"

这篇关于通过Powershell导出Azure广告组成员身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆