When creating user accounts and Mailboxes in Office 365 the default Microsoft password policy is applied, which means you have to change your password every 90 days.
While it is a best practice to change your password on a regular basis not every customer is too happy with this. I can think of one exception and that’s a service account, this makes sense to have the password set to never expire.
To change this option for user accounts in Office 365 you have to use the Windows Azure Active Directory PowerShell module to connect to Office 365 using the following commands:
$msolcred = get-credential connect-msolservice -credential $msolcred
To set the password to never expire for user email@example.com you can use the following command:
Set-MsolUser -UserPrincipalName firstname.lastname@example.org -PasswordNeverExpires $true
And to change it for all users in the entire Office 365 tenant you can use the following command:
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true
For more information regarding managing Azure Active Directory using PowerShell you can visit the following Microsoft site: Manage Azure AD using Windows PowerShell.