How to set Office 365 password to never expire

First you need to make sure you have the Azure AD Module installed on the computer.
If you do not have the the Azure AD Module installed you need to:
Open PowerShell as administrator
Run the command
(get-item C:\Windows\System32\WindowsPowerShell\v1.0\Modules\MSOnline\Microsoft.Online.Administration.Automation.PSModule.dll).VersionInfo.FileVersion

Then you need to run the following commands in powershell:
$msolcred = get-credential
connect-msolservice -credential $msolcred
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

You can check if this has worked by running the following command in powershell
Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires