Using Connect-MicrosoftTeams in Azure Automation with Managed Identity

Jesus Chao 141 Reputation points
2022-01-24T18:08:26.297+00:00

We are in the process of moving our Azure Automation Runbooks to using the built-in Managed Identity as Microsoft has recommending lately. In the process of migrating, we have some runbooks that utilize the Microsoft Teams Powershell module to automate Teams functions. Our current runbooks are utilizing a stored credential to connect.

The Connect-MicrosoftTeams cmdlet has a parameter called -accesstokens. We have attempted to get this to work within Azure Automation using the managed identity and we get errors when attempting to connect. We are grabbing both a Graph and Teams token and we have the appropriate permissions setup as far as I can tell. We receive the following:

Object reference not set to an instance of an object.
Object reference not set to an instance of an object.

We attempted Connect-MicrosoftTeams -indentity (which is undocumented BTW on the Microsoft documentation web site) and this does allow a connection and allows us to use Get-Team cmdlet. However when using the Get-CS* cmdlets, we receive:

Failed
The remote server returned an error: (404) Not Found. (The remote server returned an error: (404) Not Found.)

Does anyone have any information on using a managed identity within Azure Automation to connect to Teams using connect-microsoftteams.

Thanks!

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,034 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,111 questions
0 comments No comments
{count} vote

Accepted answer
  1. Vasil Michev 94,911 Reputation points MVP
    2022-01-24T19:30:59.177+00:00

    Managed identity scenarios are not supported afaik. Keep in mind that any such scenarios require extensive changes on the backend, not just introducing parameters for Connect-MicrosoftTeams. Though they are supposedly working on CBA, so fingers crossed :)


0 additional answers

Sort by: Most helpful