Azure Automation Powershell Runbook Teams Phone System cmdlets

Copper Contributor

Hi all, 

 

I'm somewhat new to Powershell and Azure, learning as I go. I am attempting to create an Azure Automation Powershell Runbook that will assign Teams phone numbers to users. I am using a system assigned managed identity, which is assigned the Teams Communicator role and TeamsSettings.ReadWrite.All permissions. The MicrosoftTeams powershell module is updated. My first step was to get it running, and I did! A simple:

 

Connect-Microsoft Teams

Get-TeamUser -groupid <TeamGUID>

 

and I received the results I expected. 

 

The Get-CsOnlineUser cmdlet is included in the MicrosoftTeams powershell module. However, it returns an error 

JoleneHanrahan_0-1694708123132.png

 

I am able to do this within my Powershell ISE, but it fails in the runbook. Makes me wonder if I have the permissions and roles correct for the managed identity? 

 

Role - Teams Communicator

Permission - TeamsSetting.ReadWrite.All

* this was done with powershell

 

Am I missing something? I've been reading up on the Get-CsOnlineUser cmdlet and it used to belong to a now deprecated Skype module, but is now included in the MicrosoftTeams powershell module. 

 

I'm really not sure what I'm missing and wondering if anyone has any advice. Big thanks!!!! 

1 Reply

@JoleneHanrahan 

 

Try assign your MI to Teams service admin and Teams Communications Administrator