How To Start with Graph PowerShell

 

๐Ÿ”ท 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.

 

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEnglish