Hi ,
Check this out (https://learn.microsoft.com/en-us/microsoft-365/admin/add-users/set-password-to-never-expire?view=o365-worldwide)
You can configure it via Office365 portal also here is the link (https://go.microsoft.com/fwlink/p/?linkid=2072756) link will route office 365 admin page setting where you can easily configure the password policy.
Let me know if this helps.