-
Notifications
You must be signed in to change notification settings - Fork 188
Fixes removal of boolean and empty Json object values from request body #3224
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
Conversation
Will this fix get released in next version? |
Looks like it takes more than an hour for Microsoft to go from accepting a bug-fix pull-request into "dev" (a common name for a development version of the software) to releasing a new production version of the Microsoft.Graph powershell module into the Powershell Gallery. @Xuzhou-Huang, I'm not a Microsoft employee, but since the pull request got accepted a few hours ago, I would expect this bug fix will make it's way into a future release - I don't know their release cadence so can't say when or in what version these fixes will be included. In the mean time, uninstalling the 2.26.1 release and re-installing 2.25.0 should help. |
related to issue #3212 and same issue as #3308 Error Message Why Details
$params
Name Value
---- -----
Description test
GroupTypes {Unified}
owners@odata.bind {https://graph.microsoft.com/v1.0/users/cd21c125-5cf4-4a41-b53c-09a85e8dfbc1, https://graph.microsoft.com/v1.0/users/497deaa5-13c3-4297-bede-5142babcb67d}
SecurityEnabled True
DisplayName TESTNEWMGGROUP
Visibility Private
MailEnabled True
ResourceBehaviorOptions {WelcomeEmailDisabled}
MailNickname TESTNEWMGGROUP
$groupeCreated = New-MgGroup -BodyParameter $params -ErrorAction:Stop -debug
DEBUG: [CmdletBeginProcessing]: - New-MgGroup begin processing with parameterSet 'Create'.
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate', ContextScope: 'Process', AppName: 'ResourcesManagement'.
DEBUG: [Authentication]: - Scopes: [TeamSettings.ReadWrite.All, Channel.Delete.All, BookingsAppointment.ReadWrite.All, AppCatalog.ReadWrite.All, ServiceMessage.Read.All, Group.ReadWrite.All, Bookings.Read.All, Directory.Read.All, ConsentRequest.Read.All, Calendars.ReadBasic.All, TeamMember.ReadWrite.All, ChannelMember.ReadWrite.All, Tasks.ReadWrite.All, ChannelSettings.ReadWrite.All, AuditLog.Read.All, ServiceHealth.Read.All, Sites.FullControl.All].
Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgGroup_Create" on target "Call remote 'POST /groups' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
DEBUG: ============================ 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.22631; fr-CH),PowerShell/7.4.7
SdkVersion : graph-powershell/2.27.0
client-request-id : 0e2ec8d2-a7ba-49a8-9c0a-eac77f3b1853
Accept-Encoding : gzip,deflate,br
Body:
{
"[email protected]": [
"https://graph.microsoft.com/v1.0/users/cd21c125-5cf4-4a41-b53c-09a85e8dfbc1",
"https://graph.microsoft.com/v1.0/users/497deaa5-13c3-4297-bede-5142babcb67d"
],
"ResourceBehaviorOptions": [
"WelcomeEmailDisabled"
],
"mailEnabled": true,
"securityEnabled": true
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 026431b9-6e43-416a-83ce-574587949efe
client-request-id : 0e2ec8d2-a7ba-49a8-9c0a-eac77f3b1853
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PEPF0000054B"}}
x-ms-resource-unit : 1
Date : Mon, 05 May 2025 10:45:18 GMT
Body:
{
"error": {
"code": "Request_BadRequest",
"message": "A value is required for property 'displayName' of resource 'Group'.",
"innerError": {
"date": "2025-05-05T10:45:19",
"request-id": "026431b9-6e43-416a-83ce-574587949efe",
"client-request-id": "0e2ec8d2-a7ba-49a8-9c0a-eac77f3b1853"
}
}
}
New-MgGroup_Create: A value is required for property 'displayName' of resource 'Group'.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-05-05T10:45:19
Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 026431b9-6e43-416a-83ce-574587949efe
client-request-id : 0e2ec8d2-a7ba-49a8-9c0a-eac77f3b1853
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PEPF0000054B"}}
x-ms-resource-unit : 1
Date : Mon, 05 May 2025 10:45:18 GMT |
Fixes #3201, #3212 #3215, #3202, #2902
The PR also updates tests to cover both boolean and empty Json object valued property scenarios.
Ensuring boolean property values are not dropped
Ensures empty Json object/list as a property value is not dropped
Example 1:

Example 2:
