How to create a team with PnP PowerShell
Sometimes I like a nice challenge. I came across a Tweet from Joanne Klein with a question about Microsoft Teams provisioning. This article describes how to create a team with PnP PowerShell and the Microsoft Graph.
Update 24/03: I have created a new blog which uses the Create Team method.
The question from Joanne
On the 23rd of january I spotted this Tweet and the first response from Drew Madelung pointed me in the right direction for a solution.
You could call graph to create via PS and use PnP to handle graph connection or use Teams module
— Drew Madelung (@dmadelung) January 24, 2019
My first attempt to create a solution
Feel free to use it (of course at your own risk ;)).
Breakdown of the solution
Basicly the script has three parts. First of all you need to connect with the Microsoft Graph and get an access token. I am using the latest PnP PowerShell module for this, so make sure you download this module before running the script.
After that you can use a POST request to create an Office 365 Group via the Microsoft Graph. This is the first step in the creation of a Team.
In the second step I am using the Group ID of the reponse to use a PUT request to create a Microsoft Team.