microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
691 stars 165 forks source link

New-MgDeviceManagementDeviceConfiguration always throws Cannot create an abstract class. #2742

Open michaeldcanady opened 3 months ago

michaeldcanady commented 3 months ago

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

  1. Execute Connect-MgGraph -Scopes @("deviceManagement.ReadWrite.All")
  2. 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"
            }
        )
    }
  3. 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 ``` ```

Configuration

Other information

No response

michaeldcanady commented 3 months ago

Issue was use of abstract type "microsoft.graph.omaSetting" needs to be subtype. Would probably be helpful to make error message more clear.

MaxCl93 commented 1 month ago

Is this still an open Bug or is there already a solution?

michaeldcanady commented 1 month ago

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”