Forum Discussion
Unified Group creation fails using Microsoft Graph app-only calls when group naming policy is set.
We are running into an issue trying to create Unified groups in our custom provisioning process (c# based) if there is a group naming policy set up. We are using Microsoft Graph in app-only context through the PnP Core library https://github.com/SharePoint/PnP-Sites-Core/blob/d5f95c7189bd5b96fa2bb1690c95195b2215ed6d/Core/OfficeDevPnP.Core/Framework/Graph/UnifiedGroupsUtility.cs#L125 which, in turn, uses the standard .NET Graph client and similar issue comes when we use graph api call.
await graphClient.Groups.Request().AddAsync(newGroup);Current Policy:
<Group name>(<Company>) - Here Company is azure ad user attribute
Error Message:
Code: Request_BadRequest Message: The property is missing a required prefix/suffix per your organization's Group naming requirements. Details: Detail0: Code: MissingPrefixSuffix Target: displayName AdditionalData: suggestedPropertyValue : sid-12-18-2021(MyCompany)()
Payload
The prefix and suffix requirement setting is set as follows https://i.stack.imgur.com/pFhmj.png. I discovered the issue only occurs when the group naming policy uses User fields tokens (e.g. [Department], [Company], ...). If I don't use then, then the check passes.
Registered azure App have enough permission set to create a groups.
What would be the root cause of the issue.
Thanks.
BR. Sid