Thursday, October 15, 2015

Office 365 - Set user password to not never expire

It is as easy as
1. Connnect-MSOLService
2. Get-MSOLUser -UserPrincipalName | Select PasswordNeverExpires
3. Set-MSOL -UserPrincipalName -PasswordNeverExpires $true
4. Get-MSOLUser -UserPrincipalName | Select PasswordNeverExpires


If all the above statements do not make any sense to you, read on...
  
I was asked by my SDM to create an Global Administrator for one of our clients and set the password expiry to be set to Never. This is what we expect with system accounts when passwords don't change normally.

I created a new account and unchecked "Make this person change their password the next time they sign in"
That's all I though was involved in setting up an account as there was no "Password Policy" that I saw and of course my assumption was not right.

Solution

If you want to apply such a policy for a specific user, PowerShell is your friend. We will see in the end what it takes to apply different password related policies for all users in an organization.

Download each of them separately (64 bit) and install one after the other.

Once all is setup, look for Windows Azure Active Directory Module for Windows PowerShell and right click and run as administrator

Type following command
Connnect-MSOLService
and connect using admin account on your tenant
First thing you need to do is verify if user password is already set to expire or not. We will run this commend again when we have applied the policy to set if it is set correctly.
Get-MSOLUser -UserPrincipalName | Select PasswordNeverExpires
This command will return you a value of True or False depending on user settings. 

To apply the password never expire policy on your user run the following command
Set-MSOL -UserPrincipalName -PasswordNeverExpires $true

Rerun
Get-MSOLUser -UserPrincipalName | Select PasswordNeverExpires 
to verify if your changes are applied or not.

Office 365 Interface

You must have realized by now that its too much work to be done if you need to apply it to the all users. Fear not my friend and continue reading.
Once you are on your Office 365 admin center click Service Settings and then select Passwords. This is where you administrate organization wide password policy. 

Happy administrating Office 365.