Please follow the below to change a password to never expire for an individual Microsoft 365 Account.
1. Install the AzureAD Module for Powershell:-
Open an elevated Windows PowerShell command prompt (run Windows PowerShell as an administrator).
In the Administrator: Windows PowerShell command window, run this command:
Install-Module -Name AzureAD
If prompted about installing a module from an untrusted repository, type Y and press ENTER
(4 minutes)
2. Install the MSOnline Module for Powershell:-
Open an elevated Windows PowerShell command prompt (run Windows PowerShell as an administrator).
In the Administrator: Windows PowerShell command window, run this command:
Install-Module -Name MSOnline
If prompted about installing a module from an untrusted repository, type Y and press ENTER
(3 minutes)
3. Run the following command and enter the Global Administrator credentials:-
Connect-MSOLService
(1 minute)
4. Run the following command:-
Set-MsolUser -UserPrincipalName "fullemailaddressofuser" -PasswordNeverExpires $true
(1 minute)
5. Run the following to obtain a list of all of the users and their current password expiry settings:-
Get-MsolUser | fl DisplayName, PasswordNeverExpires
(1 minute)


Leave a Reply