Settings app has a built-in feature that can detect when your Microsoft 365 has expired and show a notification directly.