How to connect to msonline using an Azure Automation Runbook and RunAs account

peter siffredi 41 Reputation points
2020-09-17T11:00:50.97+00:00

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

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,255 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,689 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 18,756 Reputation points
    2020-09-22T08:43:53.377+00:00

    @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.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.