Scenario
Consider you have teams automation in place and wanted to add Power App to Microsoft Teams Channel as a Tab. This can be useful in a way when teams are automatically created and we need to add a tab using automation, in this case, we would be using Power Apps but the same concept can be used to add a Tab with any URL.
General notes about solution for our understanding,
- We would be using Team Graph API to add a tab - below endpoint needs to be called - https://docs.microsoft.com/en-us/graph/api/channel-post-tabs?view=graph-rest-1.0
- If we look at the documentation, it would need a targeted team ID and Channel ID, so this can be obtained by querying based on a team name or channel name. Or based on your scenario, this can be retrieved from any data source. For the sake of this example, we will use a hardcoded team ID and Channel ID
- We need to create an Azure AD App and provide the necessary permission to call the below endpoint,
POST /teams/{team-id}/channels/{channel-id}/tabs - To call any Graph API from Power Automate, there are several ways, we will use HTTP POST action to make calls and use advanced options to pass the required tenant ID, client ID, secret, etc.
Let us start building the solution,
Create an Azure AD APP and Provide the necessary Permissions
Pre-requisite
To do this, we need to have access to Azure AD and also admin access to provide consent because we would be calling the targeted endpoint using Application Permissions to avoid sending the user's credentials.
Go to portal.azure.com, and select Azure AD.

Once we are on the below page, select App Registrations from the left side. Select New Registration from the top.

On the below page, provide the name of the AD app, select the first option that says to access this API in this tenant only, and click on Register,

Once it is created successfully, we should see the below page. Click on API Permissions and Add a Permission.

At the below options, select Graph API.

In our case, as I said we will be using application permission so choose Application permission.
Search for TeamsTab in the search box select the below permissions and Click on the Add permissions button.

Once permission is added, we should see the below screen and a warning for each permission saying that Not granted for .....We need to provide admin consent so that it allows to use of this client app to make calls to Graph API based on targeted permissions. Click on the Grant Admin content button as marked below.

We will be shown a confirmation box and then we should see below tick marks with a message that consent is granted for each permission.

The next step is to create a client secret that will be used later, click on Certificates and Secrets from the left blade and click on New Client Secret.











Olivier NDPosted Oct 19, 2023, 11:39 AM
Hi Siddharth, this is a very helpful article. Can you show us how to proceed if we want to add to the specific channel? You said that :" we just need to use an HTTP post call outside of the loop" How do you mean that exaclty? Thank you.
Uday DodiyaPosted Sep 2, 2022, 11:12 AM
Nice article
Stephane LELONGPosted May 15, 2022, 8:52 AM
Thank you very much, really appreciated!!