A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
After making sure that EWS was enabled both at the tenant level and at the user level, and after trying all sorts of different ideas, I thought I would check whether I could connect another email account from the same tenant to the Mac Mail. To my surprise, I was able to do it successfully.
I then opened the Passwords app on the Mac and deleted all the entries related to the Microsoft account. After that, I tried adding the account again, and this time it worked.