Automation Runbook not working with Connect-ExchangeOnline module

Aedan Glasby 1 Reputation point
2021-12-07T04:19:19.327+00:00

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?

Thank you.

155488-image.png

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,073 questions
{count} votes