Telstra (Retired)
Telstra (Retired)

Passwords to never expire for Office 365 users

Hi Guys,


The default Expiration of user passwords is set to 90 days, here are commands to configure passwords to never expire for Office 365


Please download Microsoft Online Services Module for Powershell


Open Office 365 Powershell Module as an administrator


To connect run:



(Enter administrator credentials)


Set password never expire for one user

Set-MsolUser -UserPrincipalName -PasswordNeverExpires $true


Set password never expire for all user

Get-MSOLUser | set-msoluser -PasswordNeverExpires $true


Check what users have the password never expire

Get-MSOLUser | select user*, password*


Alternatively, to see all users and their "Password never expires setting", you can run the following PowerShell command:

Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires


To check if one user has enabled, run the command below:

Get-MSOLUser  -UserPrincipalName | select user*, password*


Note This procedure does not apply to users who are enabled for single sign-on (SSO). This is because passwords for SSO-enabled users are managed in the on-premises environment. If you try to perform this procedure for an SSO-enabled user, you receive output that resembles the following in Windows PowerShell:

Set-MsolUser : Unable to update parameter. Parameter name: PasswordPolicies.
At line:1 char:13
+ Set-MsolUser <<<< -UserPrincipalName
-PasswordNeverExpires $true
+ CategoryInfo : OperationStopped: ( : ) [Set-MsolUser], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.PropertyNotSettableException, Microsoft.Online.Administration.Automation.SetUser

Note Only passwords for user accounts that are not synchronized through directory synchronization can be configured to never expire.


Need help? Check out our Community Wiki or Support Portal || Looking for a new mobile? Order online today || Don't forget to tag answers as Accepted Solutions and give a Like to the member(s) who helped you out.

All moderation actions are supported by the CrowdSupport Community Guidelines

Was this helpful?

  • Yes it was, thank you
  • No, I still need help
Level 1: Cadet

Re: Passwords to never expire for Office 365 users

Thanks for the post i made a youtube video People can follow along with your guide here

Telstra 24x7®

Manage your business services on your mobile with the Telstra 24x7® App

Find out more
Find out more about the Telstra 24x7 App ×
Manage your services and take advantage of offers while you’re out and about with the Telstra 24x7® App Find out more
Earn points on our new rewards program and enjoy tier benefits like discounted movie tickets and moreFind out more

Need a hand or want to share your expertise?
Register for CrowdSupport and get involved

Register now