How to configure user passwords to never expire in Office...

How to configure user passwords to never expire in Office 365
This article describes how to configure user passwords never to expire in Microsoft Office 365. You can use the
Microsoft Online Services Module for Windows PowerShell to set user passwords to never expire.
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 [email protected]
-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.
Check whether a password is set to never expire
To check whether a password is set to never expire, determine whether the PasswordNeverExpires setting is
enabled or disabled for a user. To do this, follow these steps:
1.
Connect to the Microsoft Online Services Module for Windows PowerShell by using your company
administrator credentials.
2.
Run the following cmdlet by using the user principal name (UPN) or the user ID of the user whom you want
to check:
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires
Or, to see all users and their PasswordNeverExpires setting, run the following cmdlet:
Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires
Configure a password to never expire
To set a user's password to never expire, enable the PasswordNeverExpires setting. To do this, follow these
steps:
1.
Connect to the Microsoft Online Services Module for Windows PowerShell by using your company
administrator credentials.
2.
Run the following cmdlet by using the UPN or the user ID of the user to configure the password to never
change:
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true
Note: If you want to change the setting for all the users in a company, run the following cmdlet:
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true
Configure a password to expire
To set a user's password to expire, disable the PasswordNeverExpires setting. To do this, follow these steps:
1.
Connect to the Microsoft Online Services Module for Windows PowerShell by using your company
administrator credentials.
2.
Run the following cmdlet by using the UPN or the user ID of the user to disable
the PasswordNeverExpiressetting:
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $false
Note: If you want to change the setting for all the users in a company, run the following cmdlet:
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $false