How to configure user passwords to never expire in Office 365

How to configure user passwords to never expire in Office 365

There are two main steps of how to set user passwords to never expire:

 

Setup Office 365 PowerShell Management Interface

The Office 365 PowerShell Management Interface offers the ability to administer service-wide features, and is not limited to a specific service like i.e. Exchange Online. The initial features that can be administered using this interface include the following:

  • Account SKUs
  • Company info
  • Contacts
  • Domains
  • Domain Federation
  • Groups
  • Partner Contracts
  • Role-based Access Control
  • Subscriptions
  • Users

This interface is available through a PowerShell Module available from here:

The Microsoft Online Services Sign-In Assistant 7.0 is a prerequisite for installing the Microsoft Online Services Module for Windows PowerShell, and is available from here:

When installed you can launch Windows PowerShell and perform the following steps:

001 

002 

003 

004

Import-Module msonline 

$cred = Get-Credential 

Connect-MsolService -cred $cred 

Get-Command –Module msonline

1) Import the module.

2) Create a credential-object stored in the variable $credimp

3) Create a new remote PowerShell connection against the PowerShell endpoint for Office 365

4) List the cmdlets available

A shortcut to the module is also available on the Start-menu (you can skip step 1 if launching this shortcut):

Here is an overview of the available cmdlets:

 

 

Run command in Office 365 PowerShell Management Interface

 

For users who are not synchronized through directory synchronization

In Office 365, customers can use the Microsoft Online Services Module for Windows PowerShell (MOSMWP) to configure their user passwords to never expire. The following steps can be provided to customers who want to configure these settings for their users.

How to check if the "Password never expires" setting is enabled or disabled for a user

  1. Connect to the Microsoft Online Services Module for Windows PowerShell by using your company administrator credentials.
  2. Run the following command by using the user principal name (UPN) or the Microsoft Online Services ID of the user you want to check:

Get-MSOLUser -UserPrincipalName <Microsoft Online Services ID> | Select PasswordNeverExpires

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

Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires

How to enable the "Password never expires" setting

  1. Connect to the Microsoft Online Services Module for Windows PowerShell by using your company administrator credentials.
  2. 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

How to disable the "Password never expires" setting

  1. Connect to the Microsoft Online Services Module for Windows PowerShell (MOSMWP) by using your company administrator credentials.
  2. 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

 

For users who are synchronized through directory synchronization

The PasswordNeverExpires setting for synchronized users must be configured by using the steps earlier in this article.  There is no Active Directory property that can be synchronized to Office 365 to set the PasswordNeverExpires setting.

 

For more information

https://onlinehelp.microsoft.com/en-us/office365-enterprises/hh125001.asp

https://onlinehelp.microsoft.com/en-us/office365-enterprises/hh534387.aspx

APPLY TO

  • Microsoft Office 365 for enterprises
  • Microsoft Office 365 for small businesses