How to Install the Microsoft Graph PowerShell Module

Microsoft Graph PowerShell Module

Managing Microsoft 365 and Azure Active Directory resources efficiently often requires automation tools beyond standard admin interfaces. This is where the Microsoft Graph PowerShell module shines – offering IT professionals and administrators a powerful way to interact with Microsoft’s cloud services through familiar command-line tools.

What is Microsoft Graph PowerShell?

The Microsoft Graph PowerShell module is your command-line gateway to Microsoft 365 data and services. With it, you can manage users, groups, calendars, files, and more – all through straightforward PowerShell commands that can be scripted and automated.

System Requirements For Microsoft Graph PowerShell

Before getting into the installation process, make sure your system meets these basic requirements:

  • PowerShell 5.1 or newer is installed on your machine
  • .NET Framework 4.7.2 or later
  • An updated version of PowerShellGet
  • Script execution policy set to RemoteSigned or less restrictive

To update your execution policy (if needed), run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Installing Microsoft Graph PowerShell Module

1. Start by opening PowerShell with administrator privileges. Right-click the PowerShell icon and select “Run as administrator” from the context menu.

2. With PowerShell running, execute this command to fetch and install the module:

Install-Module Microsoft.Graph -Scope CurrentUser

3. When prompted about installing from an untrusted repository, type Y and press Enter to continue. The system will download and install the necessary components.

4. Once the installation finishes, check that everything is installed correctly by running:

Get-InstalledModule Microsoft.Graph

You’ll see details about the module version, name, and description if successful.

Working with Microsoft Graph PowerShell

Importing the Graph Module

Before using any Microsoft Graph commands in a new PowerShell session, you’ll need to import the module:

Import-Module Microsoft.Graph

Connecting to Microsoft Graph

To start working with Microsoft 365 resources, you’ll need to authenticate. The following command connects to Microsoft Graph with specific permission scopes:

Connect-MgGraph -Scopes "User.Read.All","Group.ReadWrite.All"

This will trigger an authentication dialog. If your account has Multi-Factor Authentication enabled, you must complete the verification process using your authentication app.

  How to Find & Replace Text in PowerShell Strings With Examples

After successful authentication, PowerShell will display a welcome message confirming your connection.

Running Your First Command

With everything set up, you can now start managing your Microsoft 365 environment. For example, to list all users in your organization:

Get-MgUser -All

Maintaining Your Installation

Updating the Powershell Graph Module

Keep your Microsoft Graph PowerShell module up to date by running:

Update-Module Microsoft.Graph

Uninstalling the Graph Module

If you need to remove the module completely, run these commands in sequence:

Uninstall-Module Microsoft.Graph -AllVersions
Get-InstalledModule Microsoft.Graph.* | ? Name -ne "Microsoft.Graph.Authentication" | Uninstall-Module
Uninstall-Module Microsoft.Graph.Authentication

The Microsoft Graph PowerShell module transforms how IT professionals interact with Microsoft 365 services. Instead of clicking through admin portals, you can now script and automate your administrative tasks, saving valuable time while reducing human error.

Whether you’re managing hundreds of user accounts, configuring security settings, or just pulling reports about your environment, this tool puts the full power of Microsoft Graph in your hands through familiar PowerShell commands.

As your organization’s cloud footprint grows, mastering tools like Microsoft Graph PowerShell becomes increasingly valuable, allowing you to build sophisticated management solutions that would be impossible through conventional interfaces.

Now that you’ve installed and configured the module, you’re ready to explore the hundreds of cmdlets available to manage your Microsoft cloud environment more effectively than ever before.