How to connect tor Microsoft PowerShell Admin centers (Teams, SharePoint, Graph, etc.) in Azure Automation Runbooks

asked 2023-01-09T23:46:55.5+00:00
Joel Taylor 61 Reputation points

Hi,
I am new to Azure Automation and I am trying to find out how to connect to Microsoft PowerShell Admin centers. For example, 'Connect-MicrosoftTeams', 'Connect-SPOService', 'Connect-MgGraph', just to name some examples. If I was to do this in PowerShell, I would be prompted to sign in with MFA. However, I am not able to accomplish this in an Azure Automation Runbook.
I have read a little about Managed Identities, but I am not sure how these can be used to run Teams, SharePoint or Graph commands through their relative modules. I watched [Introduction to Azure Automation][1] and read [Authenticate access with system-assigned managed identity][2], but this only helps me connect to AzAccount. How can I use the SAMI to run Teams, SharePoint, Graph... commands?
I apologise if this is a somewhat poor question. Thank you for your assistance.

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
12,569 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
684 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
5,976 questions
No comments
{count} votes

Accepted answer
  1. answered 2023-01-10T07:08:18.18+00:00
    Vasil Michev 61,451 Reputation points Microsoft MVP

    Most modules do support managed identities, so they are your best bet. Other than that, you can obtain a token and pass it. Take a look at these articles for more details:

    https://practical365.com/managed-identity-powershell/ https://practical365.com/azure-automation-managed-identity-exo/


0 additional answers

Sort by: Most helpful