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 :)
Using Connect-MicrosoftTeams in Azure Automation with Managed Identity
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!