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

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

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.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,898 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,311 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,233 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,297 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 114K Reputation points MVP
    2023-01-10T07:08:18.18+00:00

    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/

    2 people found this answer helpful.

0 additional answers

Sort by: Most 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.