Check if a SharePoint site has a Microsoft Team associated to it using PowerShell PnP

First post of 2021, and in this brief post, we’re going to see how we can check if our SharePoint Online sites have a Microsoft Teams team associated to it.
Why is it brief? Because PowerShell PnP is making it very easy! 🤩

From now on, we’re also going to focus on the new PnP PowerShell module available for PowerShell Core. This is the module we’re familiar with, but available on Windows, MacOS, or Linux!

Alright, let’s start.

 

Connection

As we are going to touch on Microsoft 365 Groups for this exercise, we need to connect to the Graph API rather than the SharePoint admin center. But how, and what permissions are we giving?
The command we’re interested in is Get-PnPMicrosoft365Group, and looking at the documentation, we can choose from 6 different permission levels. For our scenario, “Group.Read.All” is enough.

So let’s run Connect-PnPOnline -Scopes "Group.Read.All"

If you’ve never given access to the PnP PowerShell app before, you’ll be prompt to consent to the permissions.

 

Get the results in ONE command

Now’s the time to run the magic command: Get-PnPMicrosoft365Group -IncludeHasTeam | Format-List

And boom! 🧨  We have it!

 

Told you it was going to be a quick and efficient one!

Thanks for reading 🙂

 

 

 

Leave a Reply

%d bloggers like this: