Next open the PowerShell and connect to Office 365 using the command:
In the logon dialog box enter your Office 365 administrator username and password.
To change a single user:
Set-MsolUser -UserPrincipalName <username> -PasswordNeverExpires $True
To change all users at once:
Get-MsolUser | Set-MsolUser -PasswordNeverExpires $True
To check if the changes have been successfull, you can run:
If the PasswordNeverExpires property is True, the change has been successful.