-
Notifications
You must be signed in to change notification settings - Fork 213
Description
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:
{
"brandingOptions": "includeCompanyLogo,includeCompanyName,includeContactInformation",
"defaultLocale": "en-us",
"displayName": "Android Non-Compliance Notification",
"lastModifiedDateTime": "2023-07-20T18:55:07.0000000Z",
"roleScopeTagIds": [ "0" ]
}
Will return error:
New-MgBetaDeviceManagementNotificationMessageTemplate_Create: The request is invalid.
Status: 400 (BadRequest)
ErrorCode:
Date: 2023-07-25T18:33:33
Debug reveals the issue in the message:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://graph.microsoft.us/beta/deviceManagement/notificationMessageTemplates
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22621; en-US),PowerShell/2023.6.0
Accept-Encoding : gzip
SdkVersion : graph-powershell-beta/2.1.0
client-request-id : 510efe78-5a64-4925-abb5-1432c0b88e6f
Body:
{}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 7e8844c3-830a-44df-a6b1-3c20c78feded
client-request-id : 510efe78-5a64-4925-abb5-1432c0b88e6f
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"USGov Arizona","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"PH1NEPF00008CCC"}}
Date : Tue, 25 Jul 2023 18:33:32 GMT
Body:
{
"error": {
"code": "",
"message": "The request is invalid.",
"innerError": {
"message": "notificationMessageTemplate.DisplayName : The DisplayName field is required.\r\n",
"date": "2023-07-25T18:33:33",
"request-id": "7e8844c3-830a-44df-a6b1-3c20c78feded",
"client-request-id": "510efe78-5a64-4925-abb5-1432c0b88e6f"
}
}
}
Another exaple:
New-MgBetaDeviceManagementGroupPolicyConfiguration -BodyParameter $( $json | ConvertFrom-Json -AsHashtable ) -Debug
Output:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://graph.microsoft.us/beta/deviceManagement/groupPolicyConfigurations
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22621; en-US),PowerShell/2023.6.0
Accept-Encoding : gzip
SdkVersion : graph-powershell-beta/2.1.0
client-request-id : 3fcf583a-e5fa-4a40-b76e-2a0aa60ab26e
Body:
{
"@odata.context": "https://graph.microsoft.us/beta/$metadata#deviceManagement/groupPolicyConfigurations/$entity"
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : be49d50e-ace6-4193-9286-19fb52f993be
client-request-id : 3fcf583a-e5fa-4a40-b76e-2a0aa60ab26e
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"USGov Arizona","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"PH1NEPF00008CCD"}}
Date : Tue, 25 Jul 2023 18:54:48 GMT
Body:
{
"error": {
"code": "",
"message": "The request is invalid.",
"innerError": {
"message": "configuration.DisplayName : The DisplayName field is required.\r\n",
"date": "2023-07-25T18:54:48",
"request-id": "be49d50e-ace6-4193-9286-19fb52f993be",
"client-request-id": "3fcf583a-e5fa-4a40-b76e-2a0aa60ab26e"
}
}
}
New-MgBetaDeviceManagementGroupPolicyConfiguration_Create: The request is invalid.
Status: 400 (BadRequest)
ErrorCode:
Date: 2023-07-25T18:54:48
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : be49d50e-ace6-4193-9286-19fb52f993be
client-request-id : 3fcf583a-e5fa-4a40-b76e-2a0aa60ab26e
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"USGov Arizona","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"PH1NEPF00008CCD"}}
Date : Tue, 25 Jul 2023 18:54:48 GMT
Module versions:
Get-Module microsoft.graph*
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.1.0 Microsoft.Graph.Authentication {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, Get-MgContext…}
Script 2.1.0 Microsoft.Graph.Beta.DeviceManagem… {Get-MgBetaAdminEdge, Get-MgBetaAdminEdgeInternetExplorerMode, Get-MgBetaAdminEdgeInternetExplorerModeSi…
Script 2.1.0 Microsoft.Graph.Beta.DeviceManagem… {Add-MgBetaDeviceManagementAndroidManagedStoreAccountEnterpriseSettingApp, Add-MgBetaDeviceManagementGro…
Script 2.1.0 Microsoft.Graph.Beta.DeviceManagem… {Get-MgBetaDeviceManagementApplePushNotificationCertificate, Get-MgBetaDeviceManagementAuditEvent, Get-M…
psversiontable
Name Value
---- -----
PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0