Automation Runbook not working with Connect-ExchangeOnline module
We have an automation runbook that stores credentials for various separate tenants and runs Exchange Online PS cmdlets across the tenants at scheduled intervals for compliance reasons.
We had been using basic authentication for Exchange Online up until recently, when Security Defaults and our own Conditional Access policies started to cause issues for this scenario, so we updated the runbook to use modern auth using the updated Connect-Exchange Online cmdlet.
This has resulted in some weird behaviour and errors however, with the Connect-ExchangeOnline cmdlet reporting that 'Admin account chosen for authentication is different from the one provided as parameter during Connect-ExchangeOnline. Please choose the same account during authentication as well.'
We believe this is due to the Azure Run-As Account being authenticated to the runbook to retrieve the secure tenant credentials stored as the initial step before we authenticate to the other tenants for Exchange Online cmdlets - the question is how do we bypass this error to allow modern auth for Exchange Online to the other tenants?