Clone your Microsoft Teams through power Automate.
As you already know there is no easy way to create folder structures apps and channels when you are cloning Microsoft Teams. In this blog we will use Power Automate to clone a already existing Teams.
For my demo, I have created one PowerApps through which will trigger my flow.
1: First lets create a flow. I am using option “Instant – from Blank” to create the flow and because I am triggering my flow through PowerApps that’s why I will choose the trigger point “PowerApps” and I am asking the Team Name and Description for the new teams to be created after cloning.

2: Similarly we will get the description of the app. You can either give manually or ask from PowerApps.

3: Next we will ask for the name of Teams which you want to copy. Then I will filter the name from all exiting teams.

4: Then we will find the Teams ID of the our Team we want to clone.

5: Now to run the API call through power automate, we will perform the Azure Authentication and will grant the required permission from Azure. Following permissions need to be granted admin consent.
– > Delegated (work or school account) : Group.ReadWrite.All , Directory.ReadWrite.All
– > Application : Group.ReadWrite.All , Directory.ReadWrite.All
6: Create a new app in azure active directory and copy the following Items from Azure app.
For this follow the path ->Home->Azure Active Directory->App Registrations->New Registration
Provide Name and click register with its default setting.
- Tenant ID
- Client ID
- Audience
- Secret

Because we are accessing teams through Microsft Graph API.so our audience would be
https://graphapi.com/.
Next Generate the Secret key by clicking the “Certificates and Secrets” Tab
7: Next I am using the HTTP Action to trigger my API. I have the following Command to execute my API For this you have to perform Azure Authentication.
Currently I am performing Active Directory OAUth Authentication.
Method: Post
URI :https://graph.microsoft.com/v1.0/teams/TeamsID/clone
Headers : Content-Type -> application/json
Body : {
“displayName” : “variable(DisplayName)”,
“description” : “Variable(description)”,
“mailNickName” : “Teams”,
“partsToClone”: “apps,tabs,setting,channels,members”,
“visibility”: “public”
}
It’s the simple JSON schema which I am using according to my need you can change accordingly.

Now when this flow run you , A new Microsoft teams will be created which will have the same structure of apps, channels, setting and members which you have in your original Teams.
8 : After triggering the flow New Microsoft teams Created successfully with the name you passed in the Power App

Limitations:
1): Site admin who originally created the team site will become the admin of cloned team.
2): Cloned team will only copy the structure of channels, setting, apps etc. It will not clone the data inside the folders. You can read about in my other blog.
Comments