Bulk User Operations
AZ-104 Weight: Low - Know the concept and CSV format
Overview
Bulk operations let you create, invite, or delete multiple users at once using CSV files. Useful for:
- Onboarding many new employees
- Migrating users from another system
- Quarterly cleanup of inactive accounts
- Inviting many external partners at once
Available Bulk Operations
| Operation | Description | Portal Location |
|---|---|---|
| Bulk create | Create multiple new users | Users > Bulk create |
| Bulk invite | Invite multiple guest users | Users > Bulk invite |
| Bulk delete | Delete multiple users | Users > Bulk delete |
| Download users | Export user list to CSV | Users > Download users |
Bulk Create Users
CSV Template Format
Name [displayName] Required,User name [userPrincipalName] Required,Initial password [passwordProfile] Required,Block sign in (Yes/No) [accountEnabled] Required,First name [givenName],Last name [surname],Job title [jobTitle],Department [department],Usage location [usageLocation],Street address [streetAddress],State or province [state],Country or region [country],Office [physicalDeliveryOfficeName],City [city],ZIP or postal code [postalCode],Office phone [telephoneNumber],Mobile phone [mobile]
John Doe,john.doe@contoso.onmicrosoft.com,TempP@ss123!,No,John,Doe,Developer,Engineering,US,123 Main St,WA,US,Building A,Seattle,98101,555-1234,555-5678
Jane Smith,jane.smith@contoso.onmicrosoft.com,TempP@ss456!,No,Jane,Smith,Manager,Sales,US,456 Oak Ave,CA,US,Building B,Los Angeles,90001,555-2345,555-6789Required Fields
| Field | Description | Example |
|---|---|---|
| displayName | Full name | John Doe |
| userPrincipalName | Sign-in name | john.doe@domain.com |
| passwordProfile | Initial password | Must meet complexity |
| accountEnabled | Yes/No | No = blocked |
Portal Walkthrough: Bulk Create
- Go to Microsoft Entra admin center
- Navigate to Identity > Users > All users
- Click Bulk operations > Bulk create
- Download the CSV template
- Fill in user data (keep the header row!)
- Upload the completed CSV
- Click Submit
Checking Results
- After submit, click Download results
- Review the results CSV:
- Success: User created
- Failure: Shows error reason (duplicate UPN, bad password, etc.)
Bulk Invite Guests
CSV Template Format
Email address to invite [inviteeEmail] Required,Redirection url [inviteRedirectURL] Required,Send invitation message (Yes/No) [sendEmail],Customized invitation message [customizedMessageBody]
partner1@external.com,https://portal.azure.com,Yes,Welcome to our project collaboration!
partner2@external.com,https://myapp.azurewebsites.net,Yes,You're invited to access our partner portal.
consultant@vendor.com,https://portal.azure.com,No,Required Fields
| Field | Description |
|---|---|
| inviteeEmail | External email address |
| inviteRedirectURL | Where to send user after acceptance |
Bulk Delete Users
CSV Format
User name [userPrincipalName] Required
john.doe@contoso.onmicrosoft.com
jane.smith@contoso.onmicrosoft.com
temp.user@contoso.onmicrosoft.comImportant Notes
- Deleted users go to Deleted users (soft delete)
- Can be restored within 30 days
- Permanent deletion after 30 days
- Cannot bulk delete users with active admin roles
Download Users
Export your user list for:
- Auditing purposes
- Backup before changes
- Analysis in Excel
- Input for other bulk operations
Steps:
- Users > All users
- Click Download users
- Select columns to include
- Choose format (CSV)
- Click Start and download when ready
PowerShell Alternative
For larger operations or automation:
# Import users from CSV
$users = Import-Csv -Path "users.csv"
foreach ($user in $users) {
$passwordProfile = @{
Password = $user.Password
ForceChangePasswordNextSignIn = $true
}
New-MgUser `
-DisplayName $user.DisplayName `
-UserPrincipalName $user.UserPrincipalName `
-PasswordProfile $passwordProfile `
-AccountEnabled:$true `
-MailNickname ($user.UserPrincipalName -split '@')[0] `
-Department $user.Department `
-JobTitle $user.JobTitle
}
# Bulk invite guests
$guests = Import-Csv -Path "guests.csv"
foreach ($guest in $guests) {
New-MgInvitation `
-InvitedUserEmailAddress $guest.Email `
-InvitedUserDisplayName $guest.Name `
-InviteRedirectUrl "https://portal.azure.com" `
-SendInvitationMessage:$true
}Common Errors and Solutions
| Error | Cause | Solution |
|---|---|---|
| Invalid UPN format | UPN doesn't match domain | Use verified domain |
| Password doesn't meet requirements | Weak password | Use complex password |
| User already exists | Duplicate UPN | Check for existing user |
| Invalid usage location | Bad country code | Use 2-letter ISO code |
| Quota exceeded | Too many users | Contact Microsoft support |
Best Practices
- Always download template - Don't create CSV from scratch
- Test with small batch - Try 2-3 users first
- Check results file - Review every failure
- Use consistent data - Standardize department names, etc.
- Backup first - Download existing users before bulk delete
Exam Tips
- Know that bulk operations use CSV files
- Understand the required fields for each operation
- Know that deleted users can be restored within 30 days
- PowerShell/Graph API is available for automation
- Operations are asynchronous - results come later
Practice Question
Scenario: You need to create 500 user accounts for new employees starting next month. You have their information in an HR spreadsheet.
What is the MOST efficient method?
A) Create each user manually in the portal
B) Use bulk create with a CSV file
C) Use Azure CLI in a loop
D) Create users via Azure DevOps pipeline
Answer
B) Use bulk create with a CSV file
Explanation: For one-time bulk creation of many users:
- Download the CSV template
- Copy data from HR spreadsheet
- Upload and create all users at once
While CLI/PowerShell works, CSV upload is simpler for one-time operations without coding. Azure DevOps is overkill for this scenario.