Black Friday sale: an extra 40% off every course until Monday, November 30.New Year sale: an extra 30% off every course until Friday, January 1.Memorial Day sale: an extra 25% off every course until Monday, May 31.SysAdmin Day sale: an extra 25% off every course until Sunday, August 1.Back to School sale: an extra 25% off every course until Sunday, August 22.Labor Day sale: an extra 25% off every course until Monday, September 6.Black Friday sale: an extra 40% off every course until Monday, November 29.New Year sale: an extra 30% off every course until Saturday, January 1.Choose your certification →

Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

2.1.6. Bulk Management with Microsoft Graph PowerShell

💡 First Principle: A portal is for one change; a script is for a thousand identical changes. Microsoft Graph PowerShell works through Graph's permission model, so every session asks for specific permission scopes — the script can do only what you consented to, which is least privilege applied to automation.

Bulk operations in the portals. The Microsoft Entra admin center has CSV-driven Bulk create (Users > Bulk create, at least User Administrator). Its template requires only Name, User name and Initial password, and it creates member users without sending invitations. Bulk invite for guests requires Email address to invite and a Redirection url. The Microsoft 365 admin center also supports multi-select actions such as assigning licenses to several users at once. These are fine for a one-off import; for anything repeatable, use PowerShell.

The current module. The AzureAD and MSOnline PowerShell modules were deprecated in March 2024; MSOnline was retired in spring 2025, and AzureAD's retirement began in October 2025. Scripts that call Connect-MsolService or Connect-AzureAD are legacy. The replacement is the Microsoft Graph PowerShell SDK (or the Microsoft Entra PowerShell module, built on Graph for compatibility with old AzureAD scripts).

The pattern.
# 1. Connect with only the scopes the task needs
Connect-MgGraph -Scopes "User.ReadWrite.All", "Organization.Read.All"

# 2. Set usage location before licensing
Update-MgUser -UserId "ana@contoso.com" -UsageLocation "US"

# 3. Find the SKU, then assign it
$sku = Get-MgSubscribedSku -All | Where-Object SkuPartNumber -eq "SPE_E5"
Set-MgUserLicense -UserId "ana@contoso.com" -AddLicenses @{SkuId = $sku.SkuId} -RemoveLicenses @()

Points worth knowing:

  • Scopes. User.ReadWrite.All lets the session create and update users and licenses; reading tenant SKUs with Get-MgSubscribedSku needs Organization.Read.All.
  • New users. New-MgUser creates an account — in practice with a display name, UPN, mail nickname, enabled state and a password profile.
  • Licenses. Set-MgUserLicense always takes both parameters: to remove a license, pass its SKU in -RemoveLicenses and an empty -AddLicenses @{}. Add DisabledPlans inside the license hashtable to turn off individual service plans.
  • Advanced queries. Some Get-MgUser filters — ne comparisons and counts, for example — need -ConsistencyLevel eventual plus a count variable.
  • Sessions. Revoke-MgUserSignInSession invalidates a user's refresh tokens so they must sign in again, which is useful after a security change or a compromise.

⚠️ Exam Trap: Any option built on Connect-MsolService, Set-MsolUserLicense or Connect-AzureAD describes a retired module, even if it would once have worked. Pick the Microsoft Graph PowerShell equivalent — and check that the scopes requested in Connect-MgGraph actually cover the task.

Reflection Question: A script creates 200 users with New-MgUser and then fails on every Set-MgUserLicense call. The connection had User.ReadWrite.All. What's the most likely missing step, and how would you add it to the script?

See how it connects
Alvin Varughese
Written byAlvin Varughese
Founder•26 professional certifications earned