How to Install and Connect to Microsoft Graph.
In this guide, we’ll walk you through the exact steps to install Microsoft Graph PowerShell, and connect to Microsoft Graph in Microsoft 365.
Microsoft Graph PowerShell is a set of modules that allows you to interact with Microsoft 365 services (such as Microsoft Entra ID (Azure AD), Exchange, Teams, SharePoint, and more) using the Microsoft Graph API, but with the simplicity of PowerShell commands.
How to Install Microsoft Graph PowerShell module(s).
1. Open PowerShell As Administrator.
2. Give the following command to install Microsoft Graph modules for the current logged in user.*
- Install-Module Microsoft.Graph -Scope CurrentUser
* Notes:
1. If prompted to trust the repository form "PSGallery' press "Y" or "A".
2. The above command will install all the Microsoft Graph command modules under your user profile. If you want to install the modules in all user profiles, give this command:
- Install-Module Microsoft.Graph -Scope AllUsers
3. Now wait for all modules to be installed.
4. When the installation is complete, give the following command to verify the installation of Microsoft Graph.
-
Get-InstalledModule Microsoft.Graph
How to Connect to Microsoft Graph.
1. After installing Microsoft Graph modules, you're ready to connect to your O365 tenant using Microsoft Graph, by giving the following command in PowerShell (Admin):
-
Connect-MgGraph -Scopes "User.Read.All","Group.ReadWrite.All"
2. On the pop-up window that appears type your Office 365 admin credentials and click OK.*
* Note: This cmdlet works for accounts with or without multi-factor authentication (MFA) enabled. If you use MFA, open "Multifactor Authenticator" app to authorize the login request.
3. Once you sign in, you will receive a "Welcome to Microsoft Graph" message and you can start using Microsoft Graph!
4. After completing you job, you can disconnect from Microsoft Graph, using this command:
- Disconnect-MgGraph
TIP: Always use the latest version of Microsoft Graph. To make sure you’re using the latest version, issue this command:
- Update-Module Microsoft.Graph
That's it! Let me know if this guide has helped you by leaving your comment about your experience. Please like and share this guide to help others.

