Office 365 - Updating All users Password at a Time

Background

We have a scenario like, in our project we must provide customers sample users for testing our SharePoint online site. We need to provide around 50+ users to the customer for testing.

So in Office 365 we have an option to create bulk users, we can have a CSV file and we can upload it from the admin portal as in the following:

Bulk user option
Figure 1: Office 365 - Bulk user option

So we have prepared our users.csv file and uploaded it and with a few steps our users are created successfully. Everything is fine so far. So for all these users Office 365 generated a random password. Then for every user, for the first time, the user must be logged in to change the password.

But our customer requirement is for all the users to have the same password and when they log in there is no need to change it.

Approaches

There are two possible approaches for this:

  1. Create the users using the bulk user option as shown in the preceding figure and then set the same password for all the users.

  2. We can set the password when creating the users.

    For both of the preceding approaches we will need to install Microsoft Online Services Sign-in Assistant and Windows Azure AD Module for Windows PowerShell (please look at the references section for more details of these tools).

    Open Windows Azure AD Module for Windows PowerShell and execute following cmdlet.

Connect-MsolService

You will get a dialog asking for the credentials for connecting to the Office 365 site as:

login

Let’s keep our CSV file ready having column “UserName”. We are ready to execute the commands and let's consider both approaches:

  1. Update the password for all the users that are created. Execute the following command:

    Import-Csv "D:\Users.csv"|%Set-MsolUserPassword -UserPrincipalName $_.UserName -NewPassword "abcd@123" -FoceChangePassword $false}.

  2. Set the password when creating the users.

    Import-Csv “D:\Users.csv” | Foreach-Object {New-MsolUser -UserPrincipalName $_. UserName -DisplayName $_.DisplayName -Password ""abcd@123" }.

References

  1. Microsoft Online Services Sign-in Assistant: MOS SIA provides sign–in capabilities to Microsoft Online services like Office 365. The MOS SIA installs client components that allow desktop applications like “Windows Azure AD Module for Windows PowerShell” to authenticate to Microsoft Online Services.

    More details: Description of Microsoft Online Services Sign-In Assistant (MOS).
  2. Windows Azure AD Module for Windows PowerShell.

Thanks!

Up Next
    Ebook Download
    View all
    Learn
    View all