Skip to main content
Post

#PowerPlatformTip 162: 'Create a Private Teams Channel from a Flow'

#PowerPlatformTip 162: 'Create a Private Teams Channel from a Flow'

TL;DR: The Teams connector’s Create a channel action has a Membership Type parameter: set it to private. Then add people with Add a member to a channel and switch Set user as channel owner on for the owner. Both are standard actions. If you want to create the channel with its owner in a single request, call Microsoft Graph POST /teams/{team-id}/channels with membershipType: "private" and a members array via HTTP with Microsoft Entra ID (premium).

When you onboard a new employee, spin up a project or open a support case, you often want a private Teams channel that only the involved people can see. Doing that by hand doesn’t scale. A flow can do it with the standard Teams connector, and Microsoft Graph is there when you need more control.

💡 Challenge

For each new project, case or onboarding you want a dedicated private channel inside an existing team, visible only to its members, with the right owner. Creating and configuring each one by hand is slow and inconsistent: wrong channel type, missing owner, forgotten members.

✅ Solution

Two routes:

🔸 Teams connector (standard): Create a channel with Membership Type = private, then Add a member to a channel for each person, with Set user as channel owner for the owner. This action only works for private and shared channels.

🔸 Microsoft Graph (premium): POST .../teams/{team-id}/channels with membershipType: "private" and the owner in the members array, in one request through HTTP with Microsoft Entra ID. See #PowerPlatformTip 138 for how that action works.

🔧 How It’s Done

Route A: Teams connector

1. Create the channel.

🔸 Action Create a channel (Microsoft Teams): Team = your team, Name = for example Case @{triggerBody()?['CaseNumber']}, Description optional, Membership Type = private.

🔸 The action returns the new channel’s ID, which the next steps use.

2. Add the owner and the members.

🔸 Action Add a member to a channel: Team, Channel = the ID from step 1, User = UPN or Microsoft Entra ID of the person, Set user as channel owner = Yes for the owner, No for everyone else.

🔸 Put the action into an Apply to each over the list of people. Only people who are members of the team can be added to its private channel.

🔸 In route A the account behind the Teams connection creates the channel, and the creator of a private channel becomes its owner. Adding the intended owner afterwards doesn’t remove the connection account, so the technical account stays an owner and a member until someone removes it. After the setup, compare the channel’s owners and members with the intended state, and keep the technical account only if you need it.

🔸 Check that the Add a member to a channel action for the owner succeeded before you report the channel as ready. If it failed, treat the run as a partial success (channel exists, owner missing) and handle that case, for example with a retry or a notification.

Route B: Microsoft Graph in one request

1. Get the team’s ID.

🔸 The team-id equals the ID of the underlying Microsoft 365 group. Take it from your trigger or from a configuration you control. If you have to look it up by name, GET https://graph.microsoft.com/v1.0/groups?$filter=displayName eq 'Project X'&$select=id can return more than one group, because display names aren’t unique. Only continue if exactly one group matches and it is the team you meant, and note that reading groups needs its own permission, which the preauthorized connector may not carry.

2. Create the private channel with an owner.

🔸 HTTP with Microsoft Entra ID → Invoke an HTTP request, Method POST, Url:

1
https://graph.microsoft.com/v1.0/teams/{team-id}/channels

🔸 Body with the owner in the members array:

1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "@odata.type": "#Microsoft.Graph.channel",
  "membershipType": "private",
  "displayName": "Case 4711",
  "description": "Private channel for case 4711",
  "members": [
    {
      "@odata.type": "#microsoft.graph.aadUserConversationMember",
      "user@odata.bind": "https://graph.microsoft.com/v1.0/users('jane@contoso.com')",
      "roles": ["owner"]
    }
  ]
}

🔸 A successful call returns 201 Created with the new channel object, including its id. Add more members right away in the same array (a normal member uses "roles": []), or later with POST .../teams/{team-id}/channels/{channel-id}/members.

3. Use the channel.

🔸 With the channel ID you can post a welcome message (Post message in a chat or channel → Post in: Channel), add members later or archive the channel when the case is closed, all in the same flow or a follow-up flow.

🎉 Result

Every project, case or onboarding automatically gets its own locked-down private channel, created in seconds and always configured the same way. The right owner is in place once the owner step has succeeded (in route A it is a second action, so check its result), and the connection account may still be an owner (see route A).

🌟 Key Advantages

🔸 No premium needed: route A uses only standard Teams actions.

🔸 Exact scoping: private channels are visible only to their members, so sensitive project or case content stays contained.

🔸 Repeatable: the same flow provisions a correctly configured channel for every new trigger.

🔸 Full control when needed: route B creates channel and owner in one request and gives you the complete Graph channel model.

⚠️ Good to Know

🔸 Licensing: HTTP with Microsoft Entra ID (preauthorized) is a premium connector. The Teams connector is standard.

🔸 Scopes of the preauthorized connector: it acts on behalf of the signed-in user with a limited set of scopes. If a required permission isn’t among them, the call fails with 403 Authorization_RequestDenied. Then use the standard Teams actions (route A) or the plain HTTP action with your own app registration.

🔸 Teams policy: an admin must allow the creation of private channels for the acting user in the Teams admin center, otherwise both routes are blocked.

🛠️ FAQ

1. Why should I set an owner right away?

A private channel is managed by its owners: they add and remove members and change settings. Set the owner in the same flow, with Set user as channel owner in route A or with "roles": ["owner"] in route B, so the channel isn’t left without the right person in charge.

2. I get a 403 Forbidden - what’s wrong?

Two common causes. First, permissions: with Graph, the identity needs Channel.Create (least privilege) or a higher permission such as Group.ReadWrite.All, and the preauthorized connector may not carry it. Second, Teams policy: an admin must allow Create private channels for the acting user.

3. What’s the difference between standard, private and shared channels here?

The membership type controls it: standard (everyone in the team), private (only the listed members) or shared (can include people outside the team). In Graph, standard and private return 201 Created; a shared channel is provisioned asynchronously and returns 202 Accepted with a link to a teamsAsyncOperation. A shared channel can be created with only one owner; add more owners afterwards.

4. Are there naming or size limits I should know?

Yes. The channel name (displayName) is limited to 50 characters, and a private channel can have up to 5,000 members (Limits and specifications for Microsoft Teams). Graph documents that a single request that creates a private channel can add at most 200 members, so add the rest afterwards.

This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy, which runs free live workshops (in German). See the next free workshop dates (in German). For companies that want this implemented for them, see KMUpower: Power Platform consulting & automation for SMEs (DACH).

This post is licensed under CC BY 4.0 by the author.

Microsoft and the Power Platform product names (for example Power Apps, Power Automate, Copilot Studio) are trademarks of the Microsoft group of companies. This is an independent website. It is not operated, sponsored or endorsed by Microsoft.