-
Notifications
You must be signed in to change notification settings - Fork 192
New-MgGroup with -BodyParameter drops parameters #3308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
With Graph Release 2.27.0 you can use this to bypass issue : -displayName and -AdditionalProperties $params = @{
mailNickname = "ABCD"
description = "Description ABCD"
groupTypes = @(
"Unified"
)
mailEnabled = $true
securityEnabled = $true
visibility = "Private"
resourceBehaviorOptions = @(
"WelcomeEmailDisabled"
)
"owners@odata.bind" = @(
"https://graph.microsoft.com/v1.0/users/$Owner1ID"
"https://graph.microsoft.com/v1.0/users/$Owner2ID"
)
}
$groupeCreated = New-MgGroup -displayName "ABCD" -AdditionalProperties $params -ErrorAction:Stop -debug
|
@archoversight please try with PowerShell 5 and let me know if it exhibits the same behavior? |
How do I install an older version of powerShell on macOS? Also why would I want to downgrade to an older version of PowerShell? I am using the latest and greatest in CI containers on Linux too, I don't want to attempt to downgrade those too. Why would this work correctly in an older version of PowerShell? If you'd like to provide installation instructions that are as simple as: "Run |
@timayabi2020 always with PS7, I did some testing and found something interesting.... I created a group manually using Connect-MgGraph and New-MgGroup with all parameters... and it worked fine. However, I did a second test from a new shell where I retrieved from a SharePoint site the metadata group to create using the Get-MgSiteListItem command and after that I call New-MgGroup but it throws the following error:" here is the loaded DLL: "Microsoft.Graph.Sites.private, Version=2.27.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Sites\2.27.0\bin\Microsoft.Graph.Sites.private.dll","False","True" In a third test, if I run Import-Module Microsoft.Graph.Groups just before executing the Get-MgSiteListItem command, then New-MgGroup works |
@jolscr thank you for sharing your findings. This is both interesting and a frustrating scenario because in my case if I encounter the same issue, all I need to do is a restart of the Powershell session and everything works ok. However, I am collecting feedback which is very helpful for the ongoing investigation. |
Please update to the latest version 2.28.0 |
just verified and it works fine with SDK version 2.28.0. Thank you very much! |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I am trying to pass a dictionary (or hash map or whatever it is called in Powershell) to
New-MgGroup
with the body parameters to create the group. But it is failing.Expected behavior
New group is created
How to reproduce
It seems to have completely dropped everything but
mailEnabled
andsecurityEnabled
.SDK Version
2.27.0
Latest version known to work for scenario above?
2.25.0
Known Workarounds
None
Debug output
Click to expand log
Configuration
Name Value
PSVersion 7.5.1
PSEdition Core
GitCommitId 7.5.1
OS Darwin 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:39 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6020
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Other information
This change was made to no longer drop true/false, but I have no idea if this now dropped everything else instead.
The text was updated successfully, but these errors were encountered: