msgraph-sdk-powershell
msgraph-sdk-powershell copied to clipboard
New-MgDeviceManagementDeviceConfiguration always throws Cannot create an abstract class.
Describe the bug
I am trying to create a Windows10 Custom Configuration but It keeps returning "Cannot create an abstract class"
Expected behavior
Create and return the Device Configuration
How to reproduce
- Execute
Connect-MgGraph -Scopes @("deviceManagement.ReadWrite.All")
- Create body hashtable
$body = @{
"@odata.type" = "#microsoft.graph.windows10CustomConfiguration"
description = "Description value"
displayName = "Display Name value"
version = 7
omaSettings = @(
@{
"@odata.type" = "microsoft.graph.omaSetting"
displayName = "Display Name value"
description = "Description value"
omaUri = "Oma Uri value"
}
)
}
- Execute
New-MgDeviceManagementDeviceConfiguration -BodyParameter $body
SDK Version
2.16.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
- PSVersion: 7.4.1
- PSEdition: Core
- GitCommitId: 7.4.1
- OS: Microsoft Windows 10.0.22631
- Platform: Win32NT
- PSCompatibleVersions: {1.0, 2.0, 3.0, 4.0…}
- PSRemotingProtocolVersion: 2.3
- SerializationVersion: 1.1.0.1
- WSManStackVersion: 3.0
### Other information
_No response_
Issue was use of abstract type "microsoft.graph.omaSetting" needs to be subtype. Would probably be helpful to make error message more clear.
Is this still an open Bug or is there already a solution?
I believe the “bug” portion is incorrect, it turns out the issue was me using the “omasetting” type, it’s abstract, so might be better as a “feature request” or something to make the error code more descriptive. Ex: “ Cannot create an abstract class omasetting”