We have a solution that uses Certificate-based Authentication with Azure Service Principals on Windows. It's documented in the following article:' Building Daemon or Service Apps with Office 365 Mail, Calendar, and Contacts APIs (OAuth2 client credential flow)
We need a solution similar to the one above that will work on Linux Servers.