@peter siffredi It is possible to connect to MSonline using a RunAs account in with an Azure Automation Runbook but to accomplish it we do have a dependency i.e., you need to store password of run as account in credential asset and also RunAs Account should have necessary permissions. To create Credential asset which stores credentials of the RunAs account, I would suggest you to go through this document.
How to connect to msonline using an Azure Automation Runbook and RunAs account
peter siffredi
41
Reputation points
Hello,
Is it possible to connect to msonline (connect-msoline) using a RunAs account in with an Azure Automation Runbook?
I can connect using a credential stored as a user account, however it does mean that I need to create a user account in Azure AD. Is it possible to use the RunAs account associated with the Runbook?
$Credential = Get-AutomationPSCredential -Name "Myconnection"
Connect-MsolService -credential $Credential
Thanks