Microsoft Teams — Get link to team

NaS IT
NaS IT
Sep 3, 2018 · 2 min read

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.

Get link to team from UI

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).

Example of email notification from Microsoft Teams

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-046f2c8274aa

This 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
PowerShell script to create team link for Microsoft Teams

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.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade