I was trying to figure out why my email on my iPhone stopped working randomly, but Outlook was fine. Turns out, Office 365 automatically expires passwords, and there’s no control over this in the web GUI. No fear, Powershell is here!
Thanks to MSO support for this nugget:
To set your password to never expire please follow the steps below:
Step 1: Download the Microsoft Online Services Module for PowerShell, available at :
http://onlinehelp.microsoft.com/en-us/office365-enterprises/ff652560.aspx
Step 2: Connect to the server with: connect-msolservice
Run the following command by using the user principal name (UPN) or the Microsoft Online Services ID of the user to configure the password for that user to never change:
Set-MsolUser -UserPrincipalName <Microsoft Online Services ID> -PasswordNeverExpires $true
Note If you want to change the setting for all the users in an organization, run the following command:
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true
To disable the “Password never expires” setting
Connect to the Microsoft Online Services Module for Windows PowerShell (MOSMWP) by using your company administrator credentials.
Run the following command by using the user principal name (UPN) or the Microsoft Online Services ID of the user to disable the Password never expire setting for that user:
Set-MsolUser -UserPrincipalName <Microsoft Online Services ID> -PasswordNeverExpires $false
Note If you want to change the setting for all the users in an organization, use the following cmdlet:
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $false