It can be done via Teams Powershell.
Here is an example from Microsoft Teams PowerShell Commands to List All Members and Owners.
(Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.)
Connect-MicrosoftTeams -AccountId ******@domain.onmicrosoft.com
$AllTeams = (Get-Team).GroupID
$TeamList = @()
Foreach ($Team in $AllTeams)
{
$TeamGUID = $Team.ToString()
$TeamName = (Get-Team | ?{$_.GroupID -eq $Team}).DisplayName
$TeamOwner = (Get-TeamUser -GroupId $Team | ?{$_.Role -eq 'Owner'}).Name
$TeamMember = (Get-TeamUser -GroupId $Team | ?{$_.Role -eq 'Member'}).Name
$TeamList = $TeamList + [PSCustomObject]@{TeamName = $TeamName; TeamObjectID = $TeamGUID; TeamOwners = $TeamOwner -join ', '; TeamMembers = $TeamMember -join ', '}
}
$TeamList | export-csv c:\temp\TeamsData.csv -NoTypeInformation
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.