How to configure user passwords to never expire in Office 365

Article ID: 2666768 - View products that this article applies to.
Not sure what release of Office 365 you're using? Go to the following Microsoft website:
Am I using Office 365 after the service upgrade?
Expand all | Collapse all

INTRODUCTION

This article describes how to set user passwords never to expire in Microsoft Office 365. You can use the Windows Azure Active Directory 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 jsmith@contoso.com
-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.

PROCEDURE

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. Start the Windows Azure Active Directory Module for Windows PowerShell.
  2. Connect to Windows Azure Active Directory (Windows Azure AD) by using Windows PowerShell. For more info about how to do this, go to the following Microsoft website:
    Connect to Windows Azure AD Using Windows PowerShell
  3. 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. Start the Windows Azure Active Directory Module for Windows PowerShell.
  2. Connect to Windows Azure AD by using Windows PowerShell. For more info about how to do this, go to the following Microsoft website: 
    Connect to Windows Azure AD Using Windows PowerShell
  3. 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. Start the Windows Azure Active Directory Module for Windows PowerShell.
  2. Connect to Windows Azure AD by using Windows PowerShell. For more info about how to do this, go to the following Microsoft website: 
    Connect to Windows Azure AD Using Windows PowerShell
  3. Run the following cmdlet by using the UPN or the user ID of the user to disable the PasswordNeverExpires setting:
    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

MORE INFORMATION

For more information about how to manage Windows Azure AD by using Windows PowerShell, go to the following Microsoft website:


Still need help? Go to the Office 365 Community website.

Properties

Article ID: 2666768 - Last Review: May 17, 2013 - Revision: 17.0
Applies to
  • Microsoft Office 365 for enterprises (pre-upgrade)
  • Microsoft Office 365 for small businesses  (pre-upgrade)
  • Microsoft Office 365 for education  (pre-upgrade)
  • Microsoft Office 365
Keywords: 
o365 o365a o365e o365m o365062011 pre-upgrade o365022013 after upgrade o365p KB2666768

Give Feedback