By default, the passwords for Office365 accounts are set to expire after 90 days. In order to set them to never expire, the PasswordNeverExpires setting needs to be changed.
You can change the days before expiration in the Office 365 admin web interface, to up to 720 days. You need to use the cmdlet below to disable password expiry for existing users.
Before setting the Office365 passwords to never expire, the Online Services Assistant and the Online Services Module for Windows PowerShell files need to be installed. If they are not already installed, links to the files are here
Right click on the Microsoft Online Services Module for Windows PowerShell shortcut on the desktop and choose Run as Administrator.
Type (or paste) this line into the PowerShell window and logon using the administrator's username and password.
$LiveCred = Get-Credential
Next, type (or paste) this command
Connect-MSOLService -Credential $cred
Check password settings
To see the PasswordNeverExpires setting for all users, run this cmdlet:
Get-MSOLUser
| Select UserPrincipalName, PasswordNeverExpires
To check the PasswordNeverExpires for just one user, use this cmdlet, replacing alias with the user's alias.
Get-MSOLUser -UserPrincipalName alias | Select PasswordNeverExpires
----------------------------------
Set passwords to never expire
Use this cmdlet to set all user's passwords to never expire.
Get-MSOLUser | Set-MSOLUser �CPasswordNeverExpires $true
To change a single user, use the following command, replacing alias with the user's alias.
Set-MsolUser -UserPrincipalName alias -PasswordNeverExpires $true
To change the passwords to expire, run the cmdlet above but use $false instead of $true.
More Information
Microsoft Online Services Sign-In Assistant for IT Professionals
Online Services Sign-In Assistant (IDCRL7) - 32 bit
Online Services Sign-In Assistant (IDCRL7) - 64 bit
Online Services Module for Windows PowerShell (32-bit)
Online Services Module for Windows PowerShell (64-bit)