image

How to create Users on m365 using PowerShell

In Microsoft 365 (M365), users are the individual accounts that people sign in with to access Microsoft services like Outlook, Teams, OneDrive, and SharePoint.

STEP 1: Use a Microsoft Entra DC admin account to connect to your Microsoft 365 tenant

  • Open your PowerShell using administrator
  • Install the Microsoft Graph PowerShell SDK module. (Install-Module Microsoft.Graph -Scope CurrentUser) some packages would be installed
  • Connect to your m365 account (Connect-MgGraph -Scopes “User.ReadWrite.All”)
  • Login with your credentials and accept the permissions

Connection to M365 Account successful

image

STEP 2: Creating a single user

  • Define Password Profile. Every new user needs a password at creation, create a password profile:
  • Create the User. Use New-MgUser with required parameters:
  • This creates a user named Adam AKT with an initial password. The user will be forced to change their password on first login.

STEP 3: Creating Multiple Users

  • Create a CSV file with the following structure (UserPrincipalName must be unique. Password must meet your organization’s password policy):
image
  • # Import users from CSV
  • # Create password profile
  • # Create new user
image
image

Conclusion:

  • Single user creation is best for one-off onboarding.
  • Bulk user creation via CSV is efficient for mass onboarding.
  • This process reduces manual effort and ensures consistency in M365 user management.

Leave a Comment

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