๐ท How to Start with Graph PowerShell (Simple Guide)
Microsoft Graph PowerShell is a powerful tool that lets you manage Microsoft 365 services using PowerShell. Whether you’re an IT admin or just exploring automation, this guide will help you get started quickly and easily.
โ What is Microsoft Graph PowerShell?
Microsoft Graph PowerShell allows you to interact with Microsoft Graph (the API that connects to Microsoft 365 services like Azure AD, Teams, Exchange, and more) using PowerShell commands.
๐ ๏ธ Step 1: Install Microsoft Graph PowerShell
Open PowerShell as Administrator and run:
Install-Module Microsoft.Graph -Scope CurrentUser
โ ๏ธ If prompted to trust the repository, type
Y
and press Enter.
๐ Step 2: Update Microsoft Graph PowerShell
To make sure you’re always using the latest version:
Update-Module Microsoft.Graph
โ Step 3: Uninstall (Remove) Microsoft Graph PowerShell
If you ever need to remove it:
Uninstall-Module Microsoft.Graph
๐ Step 4: Connect to Microsoft Graph
To start using the module, you need to sign in:
Connect-MgGraph
Youโll be prompted to sign in with your Microsoft 365 account.
๐ Step 5: Use Basic Commands
Here are a few examples to get you started:
๐ Get your user profile:
Get-MgUser -UserId yourname@domain.com
๐ฅ List all users:
Get-MgUser
๐งโ๐ป Create a new user:
New-MgUser -DisplayName "John Doe" -UserPrincipalName "johndoe@domain.com" -AccountEnabled $true -MailNickname "johndoe" -PasswordProfile @{ ForceChangePasswordNextSignIn=$true; Password="YourSecureP@ssword1" }
๐ช Disconnect from Graph:
Disconnect-MgGraph
๐ก Tips
- Use
Get-Command -Module Microsoft.Graph*
to explore available commands. - Use
Get-Help <command>
for help on any command. For example:
Get-Help Get-MgUser -Detailed
๐ฏ Final Thoughts
Microsoft Graph PowerShell is your gateway to automating and managing Microsoft 365 services efficiently. With just a few commands, you can handle users, devices, Teams, and much more.
Leave a Reply