PowerShell script for exporting Group Source from Entra ID

Nidhi Priya 426 Reputation points
2024-07-03T10:54:43.8133333+00:00

Hello experts,

I have to export the group source that the whether the group is cloud or on-prem synced group from the Entra ID using powershell module. Can anyone help me out for the same?

User's image

Looking for a quick reply.

Thanks!

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,273 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,368 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 99,431 Reputation points MVP
    2024-07-03T15:37:29.64+00:00

    You can use the OnPremisesSyncEnabled enabled property for that. Here is a sample cmdlet that does the export, add any other properties you are interested in as needed:

    Get-MgGroup -Property id,displayName,mailEnabled,securityEnabled,groupTypes,onPremisesSyncEnabled,mail -All | select id,displayName,mailEnabled,securityEnabled,groupTypes,onPremisesSyncEnabled,mail | Export-CSV -nti C:\temp\blabla.csv
    
    
    0 comments No comments