User passwords in Office 365 are set to expire every 90 days by default. If you don’t want to change your passwords that often, you can set the expiration time for a user password up to 730 days.
It may also be a requirement to set some passwords to never expire. This setting is often used for service accounts and should not be set for user accounts. The password policy can only be changed to never expire using PowerShell.
Read here how to connect to your Office 365 tenant using PowerShell.