We recently used an version of your script from https://github.com/TS-Steff/PRTG-Veeam-MS365-Tenant - but after the upgrade to V8, it's not workling anymore. Also there where a lot of changes, running on PostgreSQL for now, MFA and so on.
We run this script by an account with disabled MFA (Service Account).
Best, Markus
Markus Hartmann | Veeam Vanguard | Veeam Legend 2024 | VMCA 2024 & VMCE 2024 | VMware Certified Implementation Expert - Data Center Virtualization 2024 | https://markushartmann.blog/