If your 'Office 365' authentication uses some sort of call back url (Oauth2 authentication for Googles and others do, me thinks), then yes ... changing site to https:// would affect the authentication.
Fix would be simple though ... or should be ... in config of Office 365 ... the Office end ... change call back url.
Note the Redirect URI. This should be the URI of your Moodle instance followed by /auth/oidc/. You will need to enter this value into Azure AD later, so note this value and put it aside.
Not an office 365 user but do use Google ... Google end has a call back url.