Tag Archive for: Azure AD

With PowerShell, you can automate tasks and manage your Microsoft 365 tenant, including adding multiple users to your organization.

To bulk import users into Microsoft 365 using PowerShell, you will need to first install the Azure Active Directory PowerShell module. You can do this by opening a PowerShell window and running the following command:

Install-Module AzureAD

Next, you will need to connect to your Microsoft 365 tenant. You can do this by running the following command and entering your Microsoft 365 global administrator credentials when prompted:

Connect-AzureAD

Now that you are connected to your tenant, you can start importing users. There are a few different ways you can do this, depending on the information you have about the users you want to import.

One option is to use a CSV file to import your users. The CSV file should contain the following information for each user:

  • UserPrincipalName: the email address of the user
  • DisplayName: the name of the user that will be displayed in Microsoft 365
  • Password: the password that the user will use to sign in to Microsoft 365

Once you have your CSV file ready, you can import the users by running the following command:

Import-Csv -Path <path to CSV file> | ForEach-Object {New-AzureADUser -UserPrincipalName $_.UserPrincipalName -DisplayName $_.DisplayName -Password (ConvertTo-SecureString -String $_.Password -AsPlainText -Force)}

Another option is to import users directly from a database or other data source. To do this, you will need to use the New-AzureADUser cmdlet and specify the required parameters for each user. For example:

New-AzureADUser -UserPrincipalName user1@example.com -DisplayName "User 1" -Password (ConvertTo-SecureString -String "Pa$$w0rd" -AsPlainText -Force)

You can use a loop or other method to iterate over the data and create the users one by one.

It’s important to note that when you bulk import users into Microsoft 365 using PowerShell, they will not be assigned a license by default. You will need to assign a license to each user using the Set-AzureADUserLicense cmdlet.

For example:

Set-AzureADUserLicense -ObjectId <object ID of the user> -AssignedLicenses <license ID>

You can also use the Set-AzureADUser cmdlet to assign other properties to the users, such as their department or job title.

For a full list of available parameters, you can use the Get-Help cmdlet to view the Set-AzureADUser cmdlet’s documentation:

Get-Help Set-AzureADUser -Detailed

In conclusion, PowerShell is a powerful tool for managing your Microsoft 365 tenant, including bulk importing users. With the Azure Active Directory PowerShell module and the appropriate cmdlets, you can easily import multiple users at once and assign them licenses and other properties.