A2oz

How Do I Add Users to PowerShell 365?

Published in Microsoft 365 Administration 2 mins read

You can add users to Microsoft 365 using the Microsoft Graph API and PowerShell.

Using the Microsoft Graph API

  1. Connect to the Microsoft Graph API:

    • Use the Microsoft Graph PowerShell module to connect to the API.
    • You'll need to authenticate with your Microsoft 365 account.
  2. Create a New User:

    • Use the New-MgUser cmdlet to create a new user account.
    • Provide the required information, such as the user's username, display name, and password.
    • You can also specify the user's license, role, and other settings.

Example:

New-MgUser -DisplayName "John Doe" -UserPrincipalName "[email protected]" -Password "P@$$w0rd"

Using the Azure Active Directory Module

  1. Connect to Azure Active Directory:

    • Use the Azure Active Directory PowerShell module to connect to your Azure AD tenant.
    • You'll need to authenticate with your Microsoft 365 account.
  2. Create a New User:

    • Use the New-AzureADUser cmdlet to create a new user account.
    • Provide the required information, such as the user's username, display name, and password.
    • You can also specify the user's license, role, and other settings.

Example:

New-AzureADUser -DisplayName "Jane Doe" -UserPrincipalName "[email protected]" -Password "P@$$w0rd"

Practical Insights

  • You can use the Get-MgUser and Get-AzureADUser cmdlets to retrieve information about existing users.
  • You can use the Set-MgUser and Set-AzureADUser cmdlets to modify user settings.
  • It's recommended to use strong passwords and enable multi-factor authentication for added security.

Solutions

  • Automate User Creation: You can automate the user creation process using PowerShell scripts.
  • Bulk User Creation: You can use the Import-Csv cmdlet to import a list of users from a CSV file and then create user accounts in bulk.

Related Articles