How to configure user passwords to never expire in Office 365

 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

 

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
     

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

 

Additional, to check if the users "Password never expires setting" are set true, you can run the following PowerShell command:

 

Command:
Get-MSOLUser -UserPrincipalName joannav@itprodev.onmicrosoft.com | FL

 

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

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:

Command:
Set-MsolUser -UserPrincipalName joannav@itprodev.onmicrosoft.com -PasswordNeverExpires $true

Note If you want to change the setting for all the users in an organization, run the following command:

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:

Command: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:

Command:
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://support.microsoft.com/kb/2666768

Comments

  • Anonymous
    January 14, 2015
    Thanks for the post i made a youtube video People can follow along with your guide here
    https://www.youtube.com/watch?v=DVnV35Yxl7c
  • Anonymous
    January 26, 2015
    Thanks for this KB. Exactly what I Need.