You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Receiving 400 BadRequest errors while building new policies with the displayName property when the property name isn't capitalized correctly. We're seeing this with every version 2.0+ cmdlet we've used so far. As soon as we capitalize the correct character, the requests will succeed.
We expect these requests to succeed as they did in previous versions
Actually, noticing quite a few parameters needing capitalization besides DisplayName - but creation in the examples above was hung up on having AT LEAST DisplayName. The second cmdlet above (New-MgBetaDeviceManagementGroupPolicyConfiguration -BodyParameter $( $json | ConvertFrom-Json -AsHashtable ) -Debug) had three parameters laid out in JSON (displayName,description and roleScopeTagIds).
The issue is caused by a breaking change that happened in ConvertFrom-Json -AsHashtable as of PowerShell 7.3 - PowerShell/PowerShell#19928. ConvertFrom-Json -AsHashtable now returns a case sensitive OrderedHashtable, which results in the code generator not serializing the properties in the request body:
As workaround, you can consider converting the OrderedHashtable back to a case insensitive Hashtable as suggested at PowerShell/PowerShell#19928 (comment):
Hello!
Receiving 400 BadRequest errors while building new policies with the displayName property when the property name isn't capitalized correctly. We're seeing this with every version 2.0+ cmdlet we've used so far. As soon as we capitalize the correct character, the requests will succeed.
We expect these requests to succeed as they did in previous versions
Example:
New-MgBetaDeviceManagementNotificationMessageTemplate -BodyParameter $( (MgBetaDeviceManagementNotificationMessageTemplate)[0].ToJsonString() | ConvertFrom-Json -AsHashtable ) -Debug
Example JSON:
Will return error:
Debug reveals the issue in the message:
Another exaple:
New-MgBetaDeviceManagementGroupPolicyConfiguration -BodyParameter $( $json | ConvertFrom-Json -AsHashtable ) -Debug
Output:
Module versions:
psversiontable
The text was updated successfully, but these errors were encountered: