Microsoft Teams: Create a Team Automatically With Approvals

A while ago, my buddy and I presented Power Automate and used it with Microsoft Graph to create Teams and Groups with Approvals. The idea is simple. Creating Teams is a boring task for administrators, so let’s automate it using Power Automate, Microsoft Forms, and Microsoft Graph. So let’s see how to create a team automatically with approvals.

It’s a lot of technology, but since we have all these cool toys to play let’s use them.

The idea

The idea is simple.

  1. Someone needs a team
  2. Submits the details of the team.
  3. Someone approves.
  4. The team gets created.

Simple right? No need to go to the administrator, submit tickets or lose more time than necessary.

So how do we do it?


To build the Flow, we need to get the necessary permissions to perform the calls. Without these permissions, our Flows won’t work, and for a good reason.

The Azure AD

All permissions are controlled in Azure AD, so let’s check how to do it.

First, let’s go to the Azure Active Directory admin center.

We have to do two things. First, we need to register a new application. It may sound strange to create an application since we’re not actually creating one, but we need to do it since we’re using API calls. To do it:

You’ll see something like this:

Please give it a name. Please avoid using special characters since they may trigger some unexpected issues. After that, we have the account types. These are the ways that your “application” will be able to authenticate to the AD. Since we’re using Power Automate, we don’t need anything else outside our tenant. The redirect URL is optional, and it provides a link to where the AD will redirect as soon as the authentication is validated. The process will always go to a Microsoft page to ensure the integrity of the authentication workflow. In our case, we don’t need this part, so we’ll leave it blank.

Press register, and you’ll have a new application:

The second part is to add permissions to it. To do that, select “API permissions.”

You’ll find only one permission to read Microsoft Graph.

To add permissions:

Select “Application Permissions” since we’ll use Power Automate to do the actions for us.

We’ll need read and write permissions to:

  1. Groups – since we’re dealing with teams
  2. Directory – to fetch information from the directory
  3. User – to add users to the team automatically

To add permissions, you can search for them and select the boxes. Then, select all the boxes you need before pressing “Add permissions.”

Please note that the permissions won’t be granted. You need to explicitly grant them using the “Grant admin consent” button

After you confirm, you’ll see the permissions granted.

Go back to the app but don’t close this page yet. We’ll need it.

The Form

By far the easiest part of the whole process.

We need 3 things:

  1. The name of the team
  2. The description of the team – it’s important to have a description of the team’s objective so that other people know when they are added.
  3. The email of the owner – who will manage the team?

That’s it. We’ll catch the information in the Flow and create the team.

The Flow

Still with me? 😀

It looks complex, but it’s not. There are some steps to consider, but when you think about it, they make sense.

Now let’s check the Flow on how to create a team automatically with approvals.

We have a few steps:

  1. Get the Form information
  2. Fetch the details of the person who submitted
  3. Create the Group in Azure AD
  4. Create the Team

We’ll use the “When a new response is submitted” trigger and the “Get response details” action to fetch all information submitted by the requester.

After this, we’ll define 3 variables with the information that we need to call Microsoft Graph’s API. We’ll need:

  1. Application ID
  2. Tenant ID
  3. Secret


You’ll find these 3 elements in the Azure AD page that you didn’t close in the previous steps 😀. So if you did, no worries:

  1. Go to
  2. Azure Active Directory
  3. App registrations
  4. Select the one that you created

You’ll find the first and the second on the main screen:

As for the 3rd, you need to create a new secret.

Copy it and insert it in the “Secret” variable:

You can close it now. We’re close, I promise.

Now let’s set up the authorization. To do it, we’ll use the “Start and wait for an approval” action and check if it’s approved with the Condition Action. Here we’ll add the approval part to the “team automatically with approvals” :).

After that, we can create the group in Azure AD using the “Create group” action.

You’ll notice that I’m not inserting the email “as is.” This is because it’s inserted by the user, and I want to remove the spaces. The formula is simple:

toLower(replace(outputs('Get_response_details')?['body/<ID>'],' ',''))

Now the part that I really don’t like but it’s necessary. Azure AD can take a few seconds to create the Group, so if we create the team right away, we can get errors because the group may not be created yet. To solve that, we need to insert a small delay to give Azure AD time to finish the tasks. You can use the “Delay” action to do this.

Finally, let’s create the team. To do it, you need to use the HTTP action.

We’ll use the group that we created before generating the HTML to send the request. The “displayName” and “description” both come from the Form. But something is missing. Where’s the authentication part? To do this, you need to “Show advanced options,” and you’ll get the following:

We’ll use the 3 variables that we defined in the beginning, and we’re all set.

Final thoughts

It’s a lot of steps; I’ll give you that. But if you think about it, we’re doing:

  1. Opening the doors for a new application with the correct permissions.
  2. Ask the user for information
  3. Send the approval request to someone.
  4. Create the team

Now you can have teams created with a click on an email. How awesome is it to create a team automatically with approvals?

Have a suggestion of your own or disagree with something I said? Leave a comment or interact on Twitter and be sure to check out other Microsoft Teams-related articles here.

Photo by Andrea Bertozzini on Unsplash

Manuel Gomes

I'm a Project Manager with experience in large projects and companies. I've worked in the past for companies like Bayer, Sybase (now SAP) and I'm currently working for Pestana Hotel Group.

View all posts by Manuel Gomes →

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: