Microsoft Graph PowerShell Commands
The Microsoft Graph PowerShell SDK: users, groups, licenses and the rest of Microsoft 365 through Graph.All Microsoft Graph PowerShell pages
- Connect-MgGraph -Scopes: which permissions to request in Microsoft Graph PowerShellConnect-MgGraph -Scopes requests delegated Graph permissions such as User.Read.All. Find the scope a cmdlet needs with Find-MgGraphCommand; app-only differs.
- Get-MgContext: check the Microsoft Graph PowerShell connection, account, tenant and scopesGet-MgContext shows the account, tenant, auth type and scopes of the current Microsoft Graph PowerShell session, and returns nothing when you are not connected.
- New-MgUser -PasswordProfile: create a Microsoft Entra user with PowerShellNew-MgUser needs DisplayName, MailNickname, UserPrincipalName, -AccountEnabled and a -PasswordProfile hashtable with Password and ForceChangePasswordNextSignIn.
- Set-MgUserLicense: assign or remove Microsoft 365 licenses with Microsoft Graph PowerShellSet-MgUserLicense -UserId -AddLicenses @{SkuId=...} -RemoveLicenses @() assigns a license. Get SKU IDs from Get-MgSubscribedSku; set UsageLocation first.