Forum Discussion
Samer Forever
Jul 23, 2018Copper Contributor
How the export Azure AD security group members email addresses into CSV?
Hi Forum, How the export Azure AD security group members email addresses into CSV? I tried this PowerShell command: Get-AzureADGroupMember -ObjectId "xxxx...." | Export-csv -path C:\Temp\Outp...
whatch
Jan 02, 2019Copper Contributor
Is there a way to run this script so that I don't have to look up the objectID every time I run the script. I want to run this based on principal name (Email Address).
SimBur2365
Feb 08, 2022Brass Contributor
How about this to allow you to input the email address of the group?
$groupmail = Read-Host -Prompt "Enter the group email address"
$groupfind = Get-AzureADGroup -All $true | Where-Object { $_.mail -eq $groupmail }
Get-AzureADGroup -ObjectId $groupfind.ObjectId | Get-AzureADGroupMember
You can also try this script - it will output all Azure AD groups and members - easily modified to include additonal information in the output.
https://www.howdoiuseacomputer.com/index.php/2021/09/12/azure-ad-output-groups-and-members-to-csv/
$groupmail = Read-Host -Prompt "Enter the group email address"
$groupfind = Get-AzureADGroup -All $true | Where-Object { $_.mail -eq $groupmail }
Get-AzureADGroup -ObjectId $groupfind.ObjectId | Get-AzureADGroupMember
You can also try this script - it will output all Azure AD groups and members - easily modified to include additonal information in the output.
https://www.howdoiuseacomputer.com/index.php/2021/09/12/azure-ad-output-groups-and-members-to-csv/