This was my solution. The challenge I had was to add a guest user to a private channel via powerautomate.
This is my solution to add Guest Users to Private Channels in MS Teams with PowerAutomate.
Step0 - Register the domain of the Guest Users in your AD account as a valida Guest Domain
Step1 - User a registration form (MS Forms)
Step2 - Create a Trigger Process in MS PowerAutomate to receive the Form Data. I like to create small/short flows to only capture and validate form data, and then call a separate Flow / RestService. This makes your solution a little bit more decoupled and reusable. (Imagine replacing the Form with a web app form or mobile app form in the future).

Create a second HTTP request trigger flow receiving the Form data (optional way to setup multi-flow solution)

Step3 - Create a Private Channel in teams via GrapAPI
GraphAPI - POST https://graph.microsoft.com/v1.0/teams/<teams_id>/channels
POST BODY:
{ "membershipType": "private", "displayName": "<e.g. channel name from form data>", "description": "<e.g. description from form data>", "members": [ { "@odata.type": "#microsoft.graph.aadUserConversationMember", "user@odata.bind": "https://graph.microsoft.com/v1.0/users('owner.user@mydomain.com')", "roles": [ "owner" ] } ], "@odata.type": "#Microsoft.Graph.channel" }

Step4 - Call GraphAPI to retrieve the Guest User Details
GraphAPI: GET https://graph.microsoft.com/v1.0/users?$filter=mail eq 'guest.user@email.com'
I have added this in a loop - since I had many members who had to be added - and I also included a condition check to check if the domain is indeed valid

Now you can assign the output (or portions of the output) to some variables
Step5 - Retrieve the ID value from the step above (Step4). This is the value that must be used to add the new guest member.

- Retrieve the ID from the Step4 output
- Also set a variable to the account type - which should (MUST BE) be "guest"
Now - Add guest users to the private teams channel
Step6 - Call GraphAPI to add guest members
GraphAPI: POST https://graph.microsoft.com/v1.0/teams/<team_id>/channels/<channel_id>/members
Post Body: The role must be "guest" for guest account But valid options for other types of access can be
- owner
- member
- guest
Microsoft documentation (HERE) states roles must be owner or empty This did not work so well for me. Use guest
{ "@odata.type": "#microsoft.graph.aadUserConversationMember", "roles": [ "@{variables('membership_type')}" ], "user@odata.bind": "https://graph.microsoft.com/v1.0/users('@{variables('principal_user')}')" }

Bonus Step Now you can catch all responses from the previous steps and respond back with an HTTP Request/Response connector.
- A 200 response on successful executions
- A non-200 response on failed executions (or how ever you desire)

To configure exception handling or failure handling responses do this below

