Sometimes the Global Administrator Can’t do Everyhing
A query about the Set-TeamPicture cmdlet asked whether global administrators were allowed to update the picture for a team. An example of running the cmdlet is as follows:
Set-TeamPicture -ImagePath c:\temp\olives.jpg -GroupId c055da06-f21d-4381-9c51-f5a239d36329
Identifying a Team Through Its Microsoft 365 Group
Of course, it’s hard to remember the GUID to identify a team, so I often end up calling the Get-UnifiedGroup cmdlet to return the object identifier. Unlike Get-Team or any of the other cmdlets in the Teams PowerShell module, the Microsoft 365 Groups cmdlets are part of the Exchange Online management module and accept identifiers like display names. Here’s what I do:
Set-TeamPicture -ImagePath c:\temp\olives.jpg -GroupId (Get-UnifiedGroup -Identity "project condor").ExternalDirectoryObjectid
After a short time to allow clients to refresh, the picture shows up in Teams:
Only Team Owners
To come back to the original question, only team owners can run Set-TeamPicture to update the picture for a team. The reason why is that the original Teams PowerShell module set out to duplicate how the Teams client works, and only owners can update a team picture through the Teams client.
Any attempt by a non-owner to update a picture gets a nice access denied error:
Set-TeamPicture : Error occurred while executing Code: ErrorAccessDenied Message: User does not have permissions to execute this action. InnerError: RequestId: 220aa139-3b46-4782-b211-36fb77671970 DateTimeStamp: 2018-11-10T11:50:02 HttpStatusCode: ErrorAccessDenied
Set-TeamPicture is covered in Chapter 14 of the Office 365 for IT Pros eBook along with lots of other information about using PowerShell with Teams and Office 365 Groups. You might find it an interesting read!