Microsoft Teams — Get link to team
Constructing team link with PowerShell script
It is possible to get an URL link to a specific team in Microsoft Teams via the user interface (either web app or desktop app), which can be useful if you want to direct a colleague or an external user to your team.

But it could be also useful to be able to get a link to the team for IT admins, especially if you have any particular provisioning process for Microsoft Teams and Office 365 Groups.
Normally if you had a member to a team via the Teams UI, this user will receive an email notification. But if you have some other process to add members to teams, they might not get this notification (and maybe you don’t want them to get it).

So let’s see how to recreate this link via PowerShell and the Microsoft Teams module.
First make sure to install the module if you don’t have it already (refer to the official documentation below).
When we use the UI, we will get an URL as below, pointing us to the team (this URL has been modified with random GUID).
https://teams.microsoft.com/l/team/19:aaa159788e329790bd4f8e045bb44444@thread.skype/conversations?groupId=a7bc28c9-e2eb-44c6-a98f-76144a339ee0&tenantId=65f2cc35-0ff1-4c78-82ab-046f2c8274aaThis URL is composed of the channel ID 19:aaa159788e329790bd4f8e045bb44444@thread.skype, the group ID of the team a7bc28c9-e2eb-44c6-a98f-76144a339ee0 and the tenant ID (Azure AD tenant) 65f2cc35–0ff1–4c78–82ab-046f2c8274aa.
You can use the script below to connect to Microsoft Teams and retrieve:
- the tenant ID returned by Connect-MicrosoftTeams
- the group ID Get-Team
- the channel ID Get-TeamChannel
To use this script, you just have to add the team display name or the team Group ID (can be retrieved from Azure AD). The URL placeholders will just be replaced by the retrieved values.
You can then send this team link to your users (internal or guest).
If you want to can also retrieve a link to a particular channel other than the default one (General), just change the Get-TeamChannel part.
