I am trying to add a user to a Sharepoint group with HTTP request in Microsoft Flow/Power automate.
The Flow first creates an Azure AD user, then adds the user to AAD security group, assigns E2 license by adding to a AAD security group that is assigned E2 licensing, and then it is supposed to add the user to Sharepoint group.
The Flow runs and succeeds, but the user is not added to the group and is not allowed to log in to the Sharepoint site.
The other actions in the Flow are "Azure AD - Create user" and "Azure AD - Add user to group". They are performed, succeed and the user is indeed created and then added to the group.
If I run the Flow again with the same user, I get the error message:
{
"status": 404,
"message": "The user does not exist or is not unique.\r\nclientRequestId: 3243155b-57c4-4786-bad7-bcb68b96f459\r\nserviceRequestId: 16873b9f-20af-2000-30c6-331d92fc4d53",
"errors": [
"-2130575276",
"Microsoft.SharePoint.SPException"
]
}
The user is able to log in at login.microsoftonline.com. When they tgo to the Sharepoint site url, they get "User does not exist in the Sharepoint catalogue"
I have tested with different users and different Sharepint groups, and the result is the same for everyone.
The image only shows the HTTP request: I have made a new flow for testing only this part, since everything else in the original Flow works fine.

In the body, the user email is entered.