Does the ActiveDirectory module for Windows Server 2022 PowerShell use Microsoft Graph?

Frederico Nunes 21 Reputation points
2022-03-14T13:20:56.097+00:00

Hello,

I am trying to figure out what is the best way to get a list of Azure Active Directory AD users/groups from Powershell.

I've found three different ways to do it:

  1. Get-ADGroup: this cmdlet is part of the "Active Directory module for Windows PowerShell", for "Windows Server 2022 PowerShell". Link here.
  2. Get-AzureADGroup: this cmdlet is part of the "Azure Active Directory PowerShell for Graph" module. This is a module for the "Azure Active Directory Powershell 2.0". Link here.
  3. Get-MgGroup: this cmdlet is part of the "Microsoft.Graph.Groups module, for the "Microsoft Graph PowerShell v1.0". Link here.

Option 1: is the option used on my script; however, I can't understand if this module is using "Azure AD graph" (which apparently is being deprecated) or if it's using Microsoft Graph.
Option 2: I am fairly sure is using Active Directory graph, which is being deprecated.
Option 3: no idea if I should be using this.

Any insights would be greatly appreciated.
Thank you.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,414 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,898 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 97,231 Reputation points MVP
    2022-03-14T14:06:25.65+00:00

    Option #1 is for on-premises AD, not Azure AD. It will help you get details on any groups that are being synchronized to Azure AD, however it cannot help you with cloud-authored groups. It doesn't use either the old Azure AD Graph nor the Microsoft Graph.
    If your goal is to manage Azure AD objects via PowerShell, use option #3.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful