Microsoft Graph PowerShell replaces the Azure AD PowerShell and MSOnline modules. Therefore, we suggest you to use MS Graph PowerShell SDK to connect with Microsoft Entra ID. In this article, you will learn how to install Microsoft Graph PowerShell module. I will try to explain it to you in the simplest and clearest way possible.
Prerequisites Microsoft Graph PowerShell
Before you can install Microsoft Graph PowerShell module, you need to set up the system. The following prerequisites are required to use the Microsoft Graph PowerShell SDK with Windows PowerShell:
- Upgrade to PowerShell 5.1 or later
- Install .NET Framework 4.7.2 or later
Install Microsoft Graph PowerShell SDK
The Microsoft Graph PowerShell SDK consist of two modules. Follow the steps below to install Microsoft Graph module and Microsoft Graph Beta module on PowerShell.
1. Set Windows PowerShell Execution Policy
By default, we can’t install scripts. To require all PowerShell scripts that you download from the internet are signed by a trusted publisher, you need to follow the steps below.
Run PowerShell as administrator, and run the cmdlet below.
Set-ExecutionPolicy RemoteSigned -ForceCode language: JavaScript (javascript)
2. Install PowerShellGet Module
Run PowerShell as administrator and run the cmdlet below.
Install-Module PowershellGet -Force
3. Install Microsoft Graph Module
Install-Module Microsoft.Graph -ForceCode language: CSS (css)It may take a couple of minutes to download and install the Microsoft Graph module.

4. Install Microsoft Graph Beta Module
Install the Microsoft Graph Beta module. Add the parameters -AllowClobber and -Force to prevent conflicts when upgrading from other module versions. This may be the case when upgrading to a new version.
Run the command below to install Microsoft Graph Beta module.
Install-Module Microsoft.Graph.Beta -AllowClobber -ForceCode language: CSS (css)It may take a couple of minutes to download and install the Microsoft Graph Beta module.

Check Microsoft Graph PowerShell Module Version
Verify you installed the Microsoft Graph module.
Use the PowerShell cmdlet below.
Get-InstalledModule Microsoft.Graph | Format-Table -AutoSizeThe output shows which MS Graph version is running.

Then also check you installed the Microsoft Graph Beta module.
Run the PowerShell cmdlet below.
Get-InstalledModule Microsoft.Graph.Beta | Format-Table -AutoSizeThe PowerShell output shows which MS Graph Beta version is running.

Connect to Microsoft Graph PowerShell
You can connect to Microsoft Graph PowerShell with or without MFA. For this example we will show you how to connect with interactive mode.
Run the PowerShell cmdlet with the scopes below.
Connect-MgGraph -Scopes 'User.Read.All'Code language: JavaScript (javascript)The sign-in window opens.
- Enter you admin account and password
- Click Sign in

If you have MFA enabled, you will get a verification code sent as a text message or to your Authentication app on your phone. If your MFA is disabled, you will not do anything here.

It shows the permissions you allow Microsoft Graph to use.
- Select Consent on behalf of your organization
- Click Accept

After the verification, you can go back to your PowerShell window.
To verify you connected with Users Read All permissions, use Get-MgUser cmdlet.
Get-MgUser -AllRun the cmdlet below to use the Microsoft Graph Beta.
Get-MgBetaUser -AllDisconnect Microsoft Graph PowerShell
Always disconnect the PowerShell session when you finish to avoid waiting for older sessions to expire.
Disconnect-MgGraphYou can check you disconnected correctly, if you run the above cmdlet again.
The output below shows there is no application to sign out from, because you already disconnected Microsoft Graph.

Update Microsoft Graph PowerShell Module
We recommend you always update to the latest version of the Microsoft Graph PowerShell module.
Run the PowerShell commands below to update the Microsoft Graph and Microsoft Graph Beta modules to the latest version available.
Update-Module Microsoft.Graph -ForceCode language: CSS (css)Update-Module Microsoft.Graph.Beta -ForceCode language: CSS (css)Uninstall Microsoft Graph PowerShell Module
To uninstall all the Microsoft Graph PowerShell modules, including the beta version, run the commands below.
Uninstall-Module Microsoft.Graph -AllowPrerelease -AllVersions
Get-InstalledModule Microsoft.Graph.Beta* | Uninstall-Module -AllowPrerelease -AllVersions
Get-InstalledModule Microsoft.Graph.* | ? Name -ne "Microsoft.Graph.Authentication" | Uninstall-Module -AllowPrerelease -AllVersions
Uninstall-Module Microsoft.Graph.Authentication -AllowPrerelease -AllVersionsCode language: JavaScript (javascript)You can get the error: No match was found. The error looks like the example shown below, but it is not a problem. It means that the specified Microsoft Graph module is already removed. Proceed with the other commands.
PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'Microsoft.Graph'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:12733 char:21
+ ... $null = PackageManagement\Uninstall-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
+ FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackageCode language: JavaScript (javascript)That’s all !
Frequently Asked Questions (FAQ)
What are the basic system requirements for installing the Microsoft Graph PowerShell module?
To install the module smoothly, you need Windows PowerShell 5.1 or newer (PowerShell 7 is highly recommended). Additionally, your system must have at least .NET Framework 4.7.2 installed, and you need to run the PowerShell console with administrator privileges.
How do I resolve the “Execution Policy” error during installation?
If your system has strict script execution restrictions, the installation will be blocked. To bypass this, open PowerShell as an administrator and run the Set-ExecutionPolicy RemoteSigned -Scope CurrentUser command. This will allow the execution of trusted scripts.
Do I have to download the entire Microsoft Graph module if I only need specific commands?
No, you do not. Microsoft Graph is a massive module. Instead of installing the entire package (Install-Module Microsoft.Graph), you can install only the specific sub-modules you need. For example, if you only need to handle user management, you can just run Install-Module Microsoft.Graph.Users to save both disk space and memory.
Why should I switch to Microsoft Graph PowerShell instead of the old AzureAD or MSOnline modules?
Microsoft has officially deprecated the legacy AzureAD and MSOnline (Msol) modules. Microsoft Graph PowerShell is now the only official, fully supported framework that meets modern security standards and provides centralized access to the entire Microsoft 365 ecosystem, including Teams, SharePoint, and Intune.
How do I update the Microsoft Graph module that is already installed on my system?
Since Microsoft updates the Graph API frequently, keeping your module up to date is crucial. To upgrade your existing installation to the latest version, simply run the Update-Module Microsoft.Graph command in your PowerShell console.
Read More: How to Easy Install RSAT on Windows 11





