Cloud Solutions Script

Teams - チームやプライベートチャネルに紐づくサイトを一覧化する

2022年5月23日

自分
閲覧ありがとうございます。ゆっくり よんでいってください

本記事に記載の内容は、
「Teams - チームやプライベートチャネルに紐づくサイトを一覧化する方法」に関する内容となっています。

運用が進んでいくと、管理者が管理しきれなくなりますよね。。。
シャドウITとは少し違いますが、どんなふうにTeamsが利用されているか確認する手として活用してみてください。

 

 

チームやプライベートチャネルに紐づく SharePoint Online サイトを一覧表示する

本手順を実施することで、
Microsoft Teams で利用されているチームやプライベートチャネルに紐づいている
SharePoint Onlineのサイトを一覧化することが可能です。

利用者が、チーム作成権限やチャネル作成権限を持っていると
管理者では把握しきれない数になっていくので、定期的に一覧化しておくことで
怪しげなチームやチャネルを発見し対処することが可能です。

 

前提条件

  • Microsoft Teams のライセンス
  • Microsoft Teams 管理者権限
  • SharePoint Online の ライセンス
  • SharePoint Online 管理者権限

 

チームやチャネルに紐づく SPOサイトの一覧化手順

Windows PowerShellを利用して、
Microsoft Teams とSharePoint Onlineに接続することで、一覧化可能です。

以下にコマンドをまとめているので、コピーして実施してみてください。

2行目の$tenantは、自身のテナントに当てはまるものを入れてください。

 command
Connect-MicrosoftTeams$tenant = "<xxx.onmicrosoft.comのxxx部分>"$adminUrl = "https://" + $tenant + "-admin.sharepoint.com"Connect-SPOService $adminUrl$teamSites = @()Get-SPOSite -Template "GROUP#0" -Limit All | ForEach-Object {$obj = New-Object object$site = Get-SPOSite -Identity $_.Url -Detailed$obj | Add-Member -NotePropertyMembers @{"Url" = $site.Url;"Title" = $site.Title;"RelatedGroupId" = $site.RelatedGroupId;"GroupId" = $site.GroupId;"StorageQuota" = $site.StorageQuota;"StorageUsageCurrent" = $site.StorageUsageCurrent;}$teamSites += ($obj | Select-Object Url, Title, RelatedGroupId, GroupId, StorageQuota, StorageUsageCurrent)}$privateChannelSites = @()Get-SPOSite -Template "TEAMCHANNEL#0" -Limit All | ForEach-Object {$obj = New-Object object$site = Get-SPOSite -Identity $_.Url -Detailed$obj | Add-Member -NotePropertyMembers @{"Url" = $site.Url;"Title" = $site.Title;"RelatedGroupId" = $site.RelatedGroupId;"GroupId" = $site.GroupId;"StorageQuota" = $site.StorageQuota;"StorageUsageCurrent" = $site.StorageUsageCurrent;}$privateChannelSites += ($obj | Select-Object Url, Title, RelatedGroupId, GroupId, StorageQuota, StorageUsageCurrent)}$teams = @()Get-Team | ForEach-Object {$obj = New-Object object$groupId = $_.GroupId$channels = Get-TeamChannel -GroupId $_.GroupId$users = Get-TeamUser -GroupId $_.GroupId$owners = $users | Where-Object { $_.Role -like "owner" }$members = $users | Where-Object { $_.Role -like "member" }$guests = $users | Where-Object { $_.Role -like "guest" }$site = $teamSites | Where-Object { $_.GroupId -eq $groupId}$privateChannels = $privateChannelSites | Where-Object { $_.RelatedGroupId -eq $groupId }$obj | Add-Member -NotePropertyMembers @{"GroupId" = $_.GroupId;"DisplayName" = $_.DisplayName;"Visibility" = $_.Visibility;"Archived" = $_.Archived;"MailNickName" = $_.MailNickName;"Description" = $_.Description;"Channels" = $channels.count;"Owners" = $owners.count;"OwnerIds" = $owners.User -join "`r`n";"Members" = $members.count;"MemberIds" = $members.User -join "`r`n";"Guests" = $guests.count;"GuestIds" = $guests.User -join "`r`n";"TeamSiteUrl" = $site.Url;"StorageQuota" = $site.StorageQuota;"StorageUsageCurrent" = $site.StorageUsageCurrent;"PrivateChannels" = $privateChannels.count;"PrivateChannelSiteUrls" = $privateChannels.Url -join "`r`n";}$teams += ($obj | Select-Object GroupId, DisplayName, Visibility, Archived, MailNickName, Description, Channels, Owners, OwnerIds, Members, MemberIds, Guests, GuestIds, TeamSiteUrl, StorageQuota, StorageUsageCurrent, PrivateChannels, PrivateChannelSiteUrls)}

 

 

その他 Teamsを管理するうえで良く使う PowerShell コマンド

PowerShell - Microsoft Teams を制御する

続きを見る

 

 

さいごに・・・

ここまで見て頂きありがとうございます。

コマンドが長く、「うわっ・・」と感じられる方いらっしゃるかもしれませんが
Teams 運用歴が長くなればなるほど、こういったコマンドが欲しくなると思うので
URLをコピペして保管しておいていただいて、必要な時に参照して頂ければうれしいですっ

-Cloud Solutions, Script