tdannecy@gmail.com

Add the Orchestry Team Information tab to all Teams with PowerShell

#Orchestry #Teams #PowerShell

My company recently performed a domain name change in SharePoint and Entra ID/Azure AD. Among other things, this migration required us to re-install and re-deploy Orchestry from scratch.

After re-installation, some sites did not have the correct “Team Information” tab listed in the General channel. “Team Information” is a critical tab that is installed/added to a Team when the Team is provisioned through the regular Orchestry workflow. Without the tab, regular users can't request or add new Guests to the Team, which is a huge headache if your tenant is configured for Orchestry governance and have dis-allowed any Guest additions, aside from admins. The tab appears like this:

Screenshot of a Teams team, General channel, on the "Team Information" tab from Orchestry

In the case of our migration, this tab wasn't showing the correct information and wouldn't load on all sites that were created with Orchestry. This tab was also missing on all other Teams that weren't provisioned using Orchestry.

To fix this issue, I wrote a PowerShell script that adds the tab to the General channel on all Teams in bulk.

Before running, make sure you update line 14 with Connect-PnPOnline -Interactive -url 'https://XXX-admin.sharepoint.com' to your correct tenant name.

Here's the script:

## Add-OrchestryTeamTabToGeneralChannel.ps1
## tdannecy@gmail.com 2024-05-19
## Imports a csv of Teams or gets all Teams, iterates through each one, then adds the Orchestry app and correct "Team Information" tab on the General channel.
## Requires Teams Administrator permissions in Entra ID/AAD, Powershell 7, Teams Preview Powershell module, and PnPPowershell module installed and configured in Entra ID/AAD.
## Teams Preview help from: https://chrishayward.co.uk/2020/08/24/microsoft-teams-installing-powershell-preview-beta-modules-manage-private-channels/

## Environment setup and config commands.
Set-Executionpolicy Unrestricted
winget install --id Microsoft.Powershell --source winget
& 'C:\Program Files\PowerShell\7\pwsh.exe'
Install-module -name 'pnp.powershell' -RequiredVersion 2.4.0
Install-Module -Name MicrosoftTeams -RequiredVersion 1.1.3-preview -AllowPrerelease
Import-Module -name 'Pnp.Powershell' -RequiredVersion 2.4.0
Connect-PnPOnline -Interactive -url 'https://XXX-admin.sharepoint.com'
cd D:\ # To get around issue with apostrophe in my username
Import-Module -name 'MicrosoftTeams' -RequiredVersion 1.1.3-preview -AllowPrerelease
Connect-MicrosoftTeams

## Get the Orchestry App ID
$orchestryappid = (Get-TeamsApp -displayname 'Orchestry').Id

## Import all Teams or from a CSV.
$teams = Get-team 
## CSV format
## TeamName, MailNickName
## KPI Task Force [EXT], KPITaskForceEXT
## IMP Shared Workspace [EXT], imp-shared-workspace-ext
#$teams = import-csv -path D:\teams1.csv

foreach ($team in $teams) {
    $groupid = (Get-PnpTeamsTeam -Identity $team.MailNickName).GroupId

    if ($groupid) {
        Add-TeamsAppInstallation -appid $orchestryappid -teamid $groupid
        Remove-PnPTeamsTab -team $groupid -channel 'General' -Identity 'Team Information' -force:$true -Erroraction SilentlyContinue
        add-pnpteamstab -team $groupid -channel 'General' -DisplayName 'Team Information' -Type custom -TeamsAppId $orchestryappid -Contenturl "https://app.orchestry.com/tabs/team-information?tid=$($groupid)&siteinfo=true&owners=true&members=true"
    }
    else {
        Write-Error 'Team not found: $($team.DisplayName)'
    }
}

Here's the script through Gist:

This script required a lot of digging into old PowerShell modules for the commands to work correctly. The command Add-TeamsAppInstallation was a hard one to track down and the pnp.powershell module required some setup ahead of time.

You can use this script with other apps and websites that you want to load in a tab, just switch out the Appid with your app and the -Contenturl with the page you want to load.

At the end of the day, this fixed my company's issue and added the correct “Team Information” Orchestry tab to all General channels in Teams.

Footer image

Discuss...