Add a tab to a Teams channel in Flow

Steven Collier [MVP]
REgarding 365
Published in
3 min readJan 9, 2019
Photo by Mike Lewis HeadSmart Media on Unsplash

In the first part of my blog on Team Provisioning I showed how you could use Flow to create a new Team by calling an Azure Automation runbook to run PowerShell code. This is a pattern we are going to build on in this post, but instead of using the Teams PowerShell module we will start calling the Microsoft Graph.

As we saw before as Teams evolves rapidly it takes time for features to trickle through the various automation tools. Flow currently has just 5 native actions for Teams, Teams PowerShell has 23 Cmdlets, while the Microsoft Graph has 48 available commands. The Graph Explorer is a fantastically easy way to try and experiment with the graph and the online documentation for the API is clear and logical. By the time you read this maybe it’s changed, I would go and check out Flow and PowerShell in-case they caught up already.

Adding Tabs isn’t something that exists in Flow or PowerShell at this point, but is available from Microsoft Graph. We’re going to build a script that we will run in Azure Automation to create a new tab to a web page we pass as a parameter. We will also need to pass the GroupID of the Team and the Channel within that Team.

Cut to the chase

It took a good few days to figure out the correct syntax to post to the tabs endpoint to create my tab and particularly how to authenticate with the right permissions in order to allow my script to access the graph. Rather than defining my own app with permissions I borrowed the same AppID that I observed being used by Teams PowerShell, hopefully this is a good idea! The process also users some resources from the AzureAD PowerShell module, so be sure to add that to your list of modules in the Automation Account.

Anyway here’s the script I ended up with, ready for you to load it into a new runbook in the Azure Automation account we created last time.

At the end of the script it returns the attributes of the tab in json just in case there’s something more you want to with it. Again in Flow my new Create Job task exposes the parameters needed for my script. In my example script I created a Team using our previous runbook, then use Flows native tasks to find the General channel, then add my tab.

As you can probably tell we are starting to build up our own library of actions we can link together in Flow, each runbook we build adds a new capability while we keep the convenience of Flow to define the specific Teams settings we are trying to set up.

--

--