How to Set Up Microsoft Graph PowerShell
Microsoft Graph PowerShell is a must-have tool for IT admins and Microsoft 365 enthusiasts who want to automate tasks and manage cloud resources efficiently. In this guide, we’ll go through the setup process step-by-step and tackle common issues you might encounter.
Prerequisites
Before we dive in, make sure your system meets the following requirements:
- PowerShell Version: PowerShell 7+ is recommended; Windows PowerShell 5.1 is the minimum.
- .NET Framework: Windows PowerShell requires .NET Framework 4.7.2 or later.
- Administrator Rights: Some steps require elevated privileges.
With these requirements met, let’s move on to the installation.
Installing Microsoft Graph PowerShell
1. Open PowerShell as Administrator
First, search for „PowerShell,“ right-click, and select Run as administrator.
2. Set Execution Policy
Next, enable script execution by setting the execution policy:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
3. Update PowerShellGet
To avoid compatibility issues, ensure your module management tools are up to date:
Install-Module PowerShellGet -Scope CurrentUser -Force -AllowClobber
4. Install Microsoft Graph PowerShell
Now, run the following command to install the module:
Install-Module Microsoft.Graph -Scope CurrentUser -Repository PSGallery -Force

If you need beta features, use:
Install-Module Microsoft.Graph.Beta -Scope CurrentUser -Repository PSGallery -Force
At this point, the installation is complete, and you can proceed with connecting to Microsoft Graph.
Connecting to Microsoft Graph
Once installed, connect to Microsoft Graph with the required permissions:
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All"

You’ll be prompted to sign in—use your Microsoft 365 credentials.
Understanding Scopes
Microsoft Graph uses permission scopes to control what data and actions an application or script can access. Therefore, selecting the right scopes is crucial. Here are some commonly used scopes:
- User.Read – Allows reading the signed-in user’s basic profile information.
- User.Read.All – Grants read access to all users in the directory (Admin consent required).
- Group.ReadWrite.All – Enables full control over groups, including creation, updating, and deletion (Admin consent required).
- Mail.ReadWrite – Provides read and write access to a user’s mailbox.
- Calendars.ReadWrite – Grants read and write access to calendar events.
- Device.Read.All – Allows reading information about all devices in the tenant (Admin consent required).
To request multiple scopes, separate them with a space:
Connect-MgGraph -Scopes "User.Read.All Group.ReadWrite.All Mail.ReadWrite"
If a scope requires admin consent, your administrator must approve it in Azure Active Directory (Entra ID) under Enterprise Applications.
By correctly configuring scopes, you ensure that your scripts have the necessary permissions without granting excessive access.
Troubleshooting Common Issues
1. Installation Errors
Issue: „Administrator rights required“ or „Could not install module.“
Fix:
- First, run PowerShell as an administrator.
- Then, use the
-Scope CurrentUser
parameter:Install-Module Microsoft.Graph -Scope CurrentUser -Repository PSGallery -Force
2. Authentication & Permission Errors
Issue: „Access Denied“ or „Insufficient privileges.“
Fix:
- Ensure correct permissions when connecting:
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All"
- Additionally, check Azure Active Directory (Entra ID) permissions and consent settings.
3. Outdated Module Issues
Issue: „Method not found.“
Fix:
- First, remove old Graph modules:
Get-InstalledModule Microsoft.Graph* | Uninstall-Module -AllVersions -Force
- Then, reinstall the module as shown above.
4. Module Not Found
Issue: „The system cannot find the file specified.“
Fix:
- Ensure correct installation.
- Restart PowerShell and manually import the module:
Import-Module Microsoft.Graph
By following these troubleshooting steps, you can resolve most issues quickly.
Final Thoughts
Following this guide ensures a smooth setup of Microsoft Graph PowerShell. With this setup, you can efficiently automate and manage Microsoft 365 services. Furthermore, understanding and using the right permission scopes enhances security while maintaining efficiency.
For more details, check out Microsoft’s official documentation.
đź’ˇ Found this helpful? Then check out more M365 automation tips at m365blog.com!