Today Microsoft released the Microsoft Teams Powershell Cmdlets module (https://www.powershellgallery.com/packages/MicrosoftTeams/0.9.0). This allows you to use PowerShell as the first basic API for Teams. Bill Bliss (@bill_bliss) from the Teams Team (still awkward wording) told us this week on Monday in a session at Microsoft Vienna that they will push the PowerShell Cmdlets in the coming weeks and the Graph API will follow. To be honest didn’t believe that they would be that fast in releasing the bits but I’m more than happy now.

To take this a little further I created an Azure Automation Runbook for the CreateTeams Cmdlet in my Azure Tenant. The Runbook itself can be triggered by a webhook. With that in hand, you basically can create a bot or a Teams app to create or update your Teams based on the cmdlets Microsoft released.  

The Runbook I created uses the basic steps for reading input from the webhook based on this blog post: https://blogs.technet.microsoft.com/stefan_stranger/2017/03/18/azure-automation-runbook-webhook-lesson-learned/ 

The $AzureOrgIdCredential variable holds a reference to the credentials you can create in the Azure Automation portal. That helps in getting rid of hard-coded credentials in your Runbooks. 

All this does is waiting to be called with a variable DisplayName in the webhook header. An example call of this would look like this:

After running the webhook the Team is visible in your client within 1-2 minutes:

 

With this in hand, you can create a new Team in your tenant by calling this webhook. Next steps would be to create a bot or an application in Teams to provide a nice interface to your users. 

To import the cmdlets to your Azure Automation portal just press the button in the powershell gallery: 

After deploying the cmdlets you can use them in your Runbooks:

This can be a starting point to create a robust and rich interface for your users that allows you to use Teams in a way where governance can be applied, something our customers are waiting for. For example, you can take this PowerShell cmdlets and use them in an AzureFunction for even more options in terms of custom code. 

In terms of governance, you can now disable the option to create Teams for every user in your tenant and only allow creation based on your own rules.