Microsoft offers a wide range of cloud services that allow users and organizations to manage data, users, devices, emails, calendars, and more. To make it easier for developers and IT administrators to interact with these services programmatically, Microsoft provides a powerful API platform called Microsoft Graph. Using Microsoft Graph, you can access data from Microsoft 365, Azure Active Directory, Outlook, Teams, OneDrive, and many other services through a single unified endpoint.
If you are new to Microsoft Graph or unsure how to get started, don’t worry. Installing and using Microsoft Graph is easier than it may seem once you understand the basics. In this guide, we will walk you through how to install Microsoft Graph and start using it on Windows, step by step, in a clear and beginner-friendly manner.
How to Install Microsoft Graph on Windows
Microsoft Graph can be used in different ways depending on your needs. You can access it via PowerShell, SDKs, or direct REST API calls. Below, we start with the most common and beginner-friendly method.
1. Make Sure You Have the Required Prerequisites
Before installing Microsoft Graph, ensure your system meets the basic requirements.
- A Windows 10 or Windows 11 PC
- An active Microsoft account or Microsoft 365 account
- Internet connectivity
- Windows PowerShell 5.1 or PowerShell 7
To check your PowerShell version:
- Press Windows + X
- Select Windows Terminal or Windows PowerShell
- Type the following command and press Enter:
$PSVersionTable.PSVersion
If PowerShell is available, you are good to proceed.
2. Install Microsoft Graph PowerShell SDK
The easiest way to install Microsoft Graph on Windows is by using the Microsoft Graph PowerShell SDK.
- Open Windows PowerShell as administrator
- Type the following command and press Enter:
Install-Module Microsoft.Graph -Scope CurrentUser - If prompted to install the NuGet provider, type Y and press Enter
- If asked to trust the repository, confirm by typing Y
Wait for the installation to complete. Once done, Microsoft Graph will be available in PowerShell.
3. Connect to Microsoft Graph
After installation, you need to authenticate and connect to Microsoft Graph.
- Open Windows PowerShell
- Run the following command:
Connect-MgGraph - A browser window will open
- Sign in using your Microsoft or Microsoft 365 account
- Grant the requested permissions
Once authenticated, PowerShell will confirm that you are connected to Microsoft Graph.
How to Use Microsoft Graph with PowerShell
After connecting successfully, you can start using Microsoft Graph commands to access and manage data.
1. Check Your Microsoft Graph Permissions
Permissions determine what data you can access using Microsoft Graph.
Command:
Get-MgContext
This shows:
- Signed-in account
- Tenant ID
- Granted permissions
- Authentication method
If required permissions are missing, you can reconnect with additional scopes.
2. Use Microsoft Graph to Get User Information
One of the most common uses of Microsoft Graph is retrieving user data.
Example command:
Get-MgUser
This command lists users in your tenant. To get details of a specific user:
Get-MgUser -UserId user@domain.com
This is useful for IT admins managing user accounts.
3. Manage Microsoft 365 Services Using Microsoft Graph
Microsoft Graph allows you to interact with multiple Microsoft services from one place.
Common examples:
- List devices:
Get-MgDevice - Get signed-in user details:
Get-MgUser -UserId me - Access groups:
Get-MgGroup
These commands help automate administrative tasks efficiently.
4. Use Microsoft Graph REST API (Optional)
If you are a developer, you can also use Microsoft Graph via REST API calls.
- Register an app in Azure Active Directory
- Assign API permissions
- Generate an access token
- Make HTTPS requests to Microsoft Graph endpoints
This method is ideal for building applications, scripts, and integrations.
5. Disconnect from Microsoft Graph
Once you are done, it is good practice to disconnect your session.
Command:
Disconnect-MgGraph
This closes the active connection and clears authentication tokens.
Wrapping Up
With that, we wrap up our complete guide on how to install and use Microsoft Graph on Windows. Whether you are an IT administrator managing Microsoft 365 resources or a developer building cloud-based applications, Microsoft Graph provides a unified and powerful way to access Microsoft services securely and efficiently.
By installing the Microsoft Graph PowerShell SDK and learning a few essential commands, you can automate tasks, manage users and devices, and interact with Microsoft cloud services with ease. If this guide helped you get started with Microsoft Graph, feel free to share your experience in the comments and bookmark our site for more Windows and Microsoft-related guides.