Skip to main content

Command Palette

Search for a command to run...

Bulk User Maintenance in Microsoft Entra ID

Published
β€’3 min read
Bulk User Maintenance in Microsoft Entra ID
P

Cloud and systems engineer with a strong foundation in networking, automation, and infrastructure design. I write about real-world challenges, best practices, and evolving trends in cloud computing, system administration, and network architecture.

πŸ”‘ 1. Prerequisites

  • Roles needed: Global Administrator or User Administrator.

  • Tooling options:

    • Microsoft Entra admin center (GUI).

    • Microsoft Graph PowerShell (scripting).

  • Data format: CSV (Comma-Separated Values).


πŸ‘₯ 2. Bulk User Creation

πŸ“‚ CSV Template Rules

  • Row 1 β†’ Version number (mandatory).

  • Row 2 β†’ Column headings:

    • Example: Name [displayName] Required
  • Row 3 β†’ Example values (must be deleted before upload).

  • From Row 4 β†’ Your real user entries.

  • Required columns:

    • Name

    • UserPrincipalName

    • InitialPassword

    • BlockSignIn (Yes/No)

⚠️ Rules & Warnings:

  • Never delete or modify rows 1–2.

  • Don’t add new columns (ignored).

  • Remove any leading/trailing spaces (causes failures).

  • Passwords must comply with tenant password policy.

πŸ“– GUI Steps

  1. Go to Microsoft Entra admin center β†’ Users β†’ All Users.

  2. Click Bulk operations β†’ Bulk create.

  3. Download CSV template, fill with user info, save as .csv.

  4. Upload CSV β†’ Validate β†’ Fix errors (if any).

  5. Submit β†’ Microsoft 365 processes the file.

  6. Check results in Bulk operation results page.

πŸ’‘ Scale: Supports 50,000+ users in one operation (can run up to 1 hour).


❌ 3. Bulk User Deletion

πŸ“‚ CSV Template Rules

  • Row 1 β†’ Version number.

  • Row 2 β†’ Column: UserPrincipalName [userPrincipalName] Required.

  • Row 3 β†’ Example (chris@contoso.com) β€” must be removed.

  • From Row 4 β†’ Actual users to delete.

⚠️ Rules:

  • Cannot edit/remove first 2 rows.

  • Only UPN required.

  • Always download the latest template.

πŸ“– GUI Steps

  1. Go to Entra admin center β†’ Users β†’ All Users.

  2. Select Bulk operations β†’ Bulk delete.

  3. Download CSV template β†’ Add UPNs.

  4. Upload CSV β†’ Validate β†’ Submit.

  5. Check results in Bulk operation results.


πŸ”„ 4. Bulk User Restore (for Deleted Users)

  • Location: Users β†’ Deleted users.

  • Template difference:

    • Requires ObjectID instead of UPN.

    • (ObjectID is the GUID assigned to each user).

πŸ“– GUI Steps

  1. In Entra admin center β†’ Users β†’ Deleted users.

  2. Click Bulk restore.

  3. Download CSV template β†’ Add ObjectIDs.

  4. Upload β†’ Validate β†’ Submit.

  5. Check results in Bulk operation results.

⚠️ Same CSV rules: cannot modify first 2 rows, no extra columns.


⚑ 5. Verify Bulk User Operations

βœ… Entra Admin Center

  • Go to Users β†’ All Users.

  • Confirm new users appear (or are removed/restored).

βœ… PowerShell (Microsoft Graph)

  1. Install and connect:

     Install-Module Microsoft.Graph -Scope CurrentUser
     Import-Module Microsoft.Graph.Identity.DirectoryManagement
     Connect-MgGraph -Scopes 'User.Read.All'
    
  2. Check users:

     Get-MgUser -Filter "UserType eq 'Member'"
    

βš™οΈ 6. Bulk Creation via PowerShell

  1. Connect with write permissions:

     Connect-MgGraph -Scopes 'User.ReadWrite.All'
    
  2. Prepare your CSV file with headers:

     UserPrincipalName,FirstName,LastName,DisplayName,UsageLocation,AccountSkuId,Password
     ClaudeL@contoso.com,Claude,Loiselle,Claude Loiselle,US,contoso:ENTERPRISEPACK,User.pw1
    
    • AccountSkuId = License type (e.g., ENTERPRISEPACK for E3).

    • Password must meet policy.

  3. Run PowerShell:

     Import-Csv -Path "C:\NewAccounts.csv" | foreach {
         New-MgUser -DisplayName $_.DisplayName `
                    -GivenName $_.FirstName `
                    -Surname $_.LastName `
                    -UserPrincipalName $_.UserPrincipalName `
                    -UsageLocation $_.UsageLocation `
                    -LicenseAssignmentStates $_.AccountSkuId `
                    -PasswordProfile $_.Password
     } | Export-Csv -Path "C:\NewAccountResults.csv"
    

🧾 7. Exam & Real-World Key Points

  • Templates differ:

    • Bulk Create β†’ Needs Name, UPN, Password, Sign-in status.

    • Bulk Delete β†’ Only needs UPN.

    • Bulk Restore β†’ Needs ObjectID.

  • First 2 rows of CSV must remain unchanged.

  • Errors are logged in a downloadable file.

  • Scale: Supports very large user batches (50k+).

  • Verification: Always check via GUI or PowerShell.

  • Best Practice:

    • Always download the latest template.

    • Test with a small batch before full bulk operation.

    • Keep a backup CSV (especially before deletion).

2 views

More from this blog

AWS

33 posts