Creating Microsoft Teams through automation can be a real time‑saver, especially when your organization relies on consistent structures for collaboration. Using a team template is a great way to ensure that every new team starts with the right channels, settings, and tabs in place. In this blog post, I’ll walk you through how to create a new team from a Teams template using Power Automate. We’ll cover the required app registration setup, retrieving an access token, and finally making the Graph API call needed to deploy your team—fully automated and ready to use.
Creating the app registration
Before we get started, I’ll assume you already know how to create an app registration in Azure AD and how to generate a client secret. For the flow we’re building, the app registration needs the following Microsoft Graph API permissions to successfully create a team and add tabs:
- Directory.ReadWrite.All
- Group.ReadWrite.All
- Notes.ReadWrite.All
- Team.Create
- TeamsTab.ReadWrite.All
- Teamwork.Migrate.All
- User.Read
Make sure these permissions are added and granted admin consent. With that in place, we can move on to using the app registration in Power Automate.
Create the team template
To prepare your Teams template for use in Power Automate, follow these steps:
- Go to the Teams admin center.
- Navigate to Teams and click on on Team template.
- Click on add to create a new team template and configure it as needed
- After saving the template, make sure to copy and store the Template ID — you’ll need it later when creating the team through a Graph API call.
Getting access token for API calls
To authenticate your Graph API requests, you first need to retrieve an access token. You can do this directly within your Power Automate flow:
- Add a HTTP action to your Power Automate Flow and name it HTTP - Get access token.
- Set the Method to Post.
- Set the URI to:
https://login.microsoftonline.com/[yourtenantid]/oauth2/v2.0/token
- Add a header:
- Content-Type and set the value to application/x-www-form-urlencoded.
- In de body, add the following code and replace the client id value and client secret values with your own values.
client_id=[value]&
scope=https://graph.microsoft.com/.default&
client_secret=[secret]&
Grant_type=client_credentials
- Add the Parse JSON action, set the content to the Body of the HTTP - Get Access token action.
- Set the schema to the following, to be able to use the returned access token.
{
"type": "object",
"properties": {
"token_type": {
"type": "string"
},
"expires_in": {
"type": "integer"
},
"ext_expires_in": {
"type": "integer"
},
"access_token": {
"type": "string"
}
}
}
Create the team
In this example, the team’s description and owner come from a SharePoint list item. Depending on your setup, the steps below may vary slightly.
- Add a Initialize variable, to create an Array called ArrayOwner1
- Set the value to the following code, to change the SharePoint column value from Owner to an array.
createArray(triggerOutputs()?['body/Owner1'])
- Add a Select action to the flow and name is Select - ArrayOwner1.
- Set the from to the variable ArrayOwner (can only contain 1 person).
- You can only set one owner when creating the team.
- Click on switch button to set the Map field in text mode.
- Add the following code to the Map (in text mode).
- This code will create the correct json for the body of the API call. If you manually set this in the Body, then the body will break because of the ' symbols.
json(concat('{"@odata.type": "#microsoft.graph.aadUserConversationMember","roles": ["owner"],"user@odata.bind": "https://graph.microsoft.com/v1.0/users(''', item()['Email'], ''')"'))
- Add a HTTP action and call it HTTP - Create Team.
- Set the Method to POST.
- Set the URI to: https://graph.microsoft.com/v1.0/teams.
- Set the header key Authorization to value Bearer [access_token].
- Set the header Content-Type to value application/json.
- Set the header key Accept to value application/json.
- Set the body as follows, but change the template id, display name and description if needed.
{
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('[Template ID')",
"displayName": "Team Example Name",
"description": "@{triggerOutputs()?['body/Description']}",
"members":
@{body('Select_-_Owner')}
}












































