Group naming policy enabled tenant - Not allowing to create 'Teams' through provisioned jobs

Brass Contributor
Hello All,

Actually We have enabled 'Group Naming policy' on our O365 tenant like below:
Current Policy:
<Group name>(<Company>)

It works perfectly fine when we create Teams through Teams App but we are facing below error
when we try to create through CSOM based (c#) provisioning console job. To fit in naming policy we
are fetching user's company name and appending suffix to Group name. Ex. TestTeam(CompanyName)
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)()
Below source code we are referring to create Teams:
UnifiedGroupEntity unifiedGroupEntity = UnifiedGroupsUtility.CreateUnifiedGroup(
unifiedGroupInformation.DisplayName, unifiedGroupInformation.Description,
unifiedGroupInformation.MailNickname, accessToken, unifiedGroupInformation.Owners,null,
true, true, 10, 500);

Please let me know where the things getting wrong.
BR/ Sid
8 Replies

@SiddheshwarKohale , There are some strict guidelines that are to be followed when creating a group policy in azure active directory that enforces consistent naming conventions for  Microsoft 365 groups created or edited by your users, set up a group naming policy for your organizations in Azure Active Directory (Azure AD). 

 

I would suggest you to refer to your naming policies in your AAD and use the same to create a group using console job. As from your error it's clear that there is some format error in prefix and suffix. 

 

Please follow this article for more details.

 

Also check if the data is already filled in object in code before creating a team

@Manish-MSFT  - We are already using C# based console job to create Teams.  Below are few more details:

Azure AD Group Policy:

Policy.png

Error Message:

ErrorMessage-2.png

Stack Trace:

ErrorMessage-1.png

UnifiedGroupInformation Payload is like this before creating Teams:

Payload.png

Code snippet:

code snippet.png

 

Still we are facing similar issue. Please suggest possible solutions if any.

 

Thanks.

BR. Sid

@SiddheshwarKohale  : We are looking into this issue, and will update you once I receive any update from internal developers team.

Hello Manish,

Thanks for taking this issue in your priority list. We are waiting for your reply on this.

Thanks.
BR. Sid

@SiddheshwarKohale : Hi Sid, can we discuss this over a call? Please write to us microsoftteamsdev@microsoft.com

@Manish-MSFT - Sure, We can discuss this case over a call. Thanks for consideration. We have sent email to 'microsoftteamsdev@microsoft.com' and provided necessary details.

@SiddheshwarKohale , As discussed over the call, please forward us the required steps for repro. The steps must be clear such that we can repro and file a bug.