-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
Labels
type:bugA broken experienceA broken experience
Description
Describe the bug
I am trying to create a new Microsoft 365 Group (before converting it to a Teams team).
I am trying to create the group using the New-MgGroup Cmdlet along with the -BodyParameter parameter, especially to select the group owner.
The same code used to work in version 2.25 and below, suddenly stopped working in 2.26.1. I installed v2.25 back and it works again with this version.
Expected behavior
PS> New-MgGroup -BodyParameter $params
DisplayName Id MailNickname Description GroupTypes
----------- -- ------------ ----------- ----------
TEST ORG 123 #groupId# test-org-123 test {Unified}
How to reproduce
$params = @{
DisplayName = "TEST ORG 123"
MailEnabled = $False
MailNickName = "test-org-123"
SecurityEnabled = $True
GroupTypes = "Unified"
Description = "Test"
}
New-MgGroup -BodyParameter $params
Throws the below error :
New-MgGroup : A value is required for property 'mailEnabled' of resource 'Group'.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-03-06T15:52:06
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 27bd77e5-6831-4dcc-ad57-25134d85e6d3
client-request-id : 32594ca4-9a5f-48db-9641-e65161ff1234
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"PA3PEPF0000F729"}}
x-ms-resource-unit : 1
Cache-Control : no-cache
Date : Thu, 06 Mar 2025 15:52:05 GMT
Au caractère Ligne:1 : 1
+ $group = New-MgGroup -BodyParameter $params
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : ({ Headers = , b...oftGraphGroup }:<>f__AnonymousType2`2) [New-MgGroup_Create], Exception
+ FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_Create
SDK Version
2.26.1
Latest version known to work for scenario above?
2.25
Known Workarounds
It works this way :
New-MgGroup @params
But then I can't use the following parameter in the set :
"owners@odata.bind" = @(
"https://graph.microsoft.com/v1.0/users('#userId#')"
)
Debug output
Click to expand log
DÉBOGUER : [CmdletBeginProcessing]: - New-MgGroup begin processing with parameterSet 'Create'.
DÉBOGUER : [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate', ContextScope: 'Process', AppName: 'CEA Teams creation'.
DÉBOGUER : [Authentication]: - Scopes: [TeamSettings.ReadWrite.All, User.ReadBasic.All, Teamwork.Migrate.All, Sites.ReadWrite.All, Team.Create, Group.ReadWrite.All].
DÉBOGUER : ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://graph.microsoft.com/v1.0/groups
Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19045; fr-FR),PowerShell/5.1.19041.5486
SdkVersion : graph-powershell/2.26.1
client-request-id : 65fa1cb0-5fbb-4ffa-a03b-55edfdca6c49
Body:
{
"description": "Test",
"displayName": "TEST ORG 123",
"groupTypes": [
"Unified"
],
"mailNickname": "test-org-123"
}
DÉBOGUER : ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : f30ba99b-a74a-4ed1-8bd9-b84f40e3a541
client-request-id : 65fa1cb0-5fbb-4ffa-a03b-55edfdca6c49
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"PA2PEPF00004EB9"}}
x-ms-resource-unit : 1
Cache-Control : no-cache
Date : Thu, 06 Mar 2025 16:02:32 GMT
Body:
{
"error": {
"code": "Request_BadRequest",
"message": "A value is required for property 'mailEnabled' of resource 'Group'.",
"innerError": {
"date": "2025-03-06T16:02:33",
"request-id": "f30ba99b-a74a-4ed1-8bd9-b84f40e3a541",
"client-request-id": "65fa1cb0-5fbb-4ffa-a03b-55edfdca6c49"
}
}
}
A value is required for property 'mailEnabled' of resource 'Group'.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-03-06T16:02:33
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : f30ba99b-a74a-4ed1-8bd9-b84f40e3a541
client-request-id : 65fa1cb0-5fbb-4ffa-a03b-55edfdca6c49
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"PA2PEPF00004EB9"}}
x-ms-resource-unit : 1
Cache-Control : no-cache
Date : Thu, 06 Mar 2025 16:02:32 GMT
New-MgGroup : A value is required for property 'mailEnabled' of resource 'Group'.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-03-06T16:02:33
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : f30ba99b-a74a-4ed1-8bd9-b84f40e3a541
client-request-id : 65fa1cb0-5fbb-4ffa-a03b-55edfdca6c49
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"PA2PEPF00004EB9"}}
x-ms-resource-unit : 1
Cache-Control : no-cache
Date : Thu, 06 Mar 2025 16:02:32 GMT
Au caractère Ligne:1 : 1
+ New-MgGroup -BodyParameter $params -Debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : ({ Headers = , b...oftGraphGroup }:<>f__AnonymousType2`2) [New-MgGroup_Create], Exception
+ FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_Create
DÉBOGUER : [CmdletEndProcessing]: - New-MgGroup end processing.
Configuration
Powershell integrated terminal in VS Code
PS> $psversiontable
Name Value
---- -----
PSVersion 5.1.19041.5486
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.5486
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Other information
The request body seems truncated in the HTTP post request.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type:bugA broken experienceA broken experience