Skip to content

Get-MgBetaDeviceManagementDeviceConfiguration - Wrong cmdlet definition #3295

Open
@FabienTschanz

Description

@FabienTschanz

Describe the bug

For the cmdlet Get-MgBetaDeviceManagementDeviceConfiguration, if the parameter DeviceConfigurationId is present with an id, it also requires that the parameter ExpandProperty is present. This was not the case with 2.26.1 and breaks every single script that fetches a single policy by its id and does not specify that additional parameter, although the parameter itself is not necessary for a correct API call.

PS> Get-MgBetaDeviceManagementDeviceConfiguration -DeviceConfigurationId <id>
Get-MgBetaDeviceManagementDeviceConfiguration : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Get-MgBetaDeviceManagementDeviceConfiguration -DeviceConfigurationId  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-MgBetaDevic...ceConfiguration], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Get-MgBetaDeviceManagementDeviceConfiguration

Expected behavior

Fetching the policy with a specific id returns the policy and does not throw an error.

How to reproduce

  1. Run Get-MgBetaDeviceManagementDeviceConfiguration -DeviceConfigurationId id
  2. See the error about Parameter set cannot be resolved using the specified named parameters

SDK Version

2.27.0

Latest version known to work for scenario above?

2.26.1

Known Workarounds

Downgrade to 2.26.1

Debug output

Click to expand log
# No changes

PS > Get-MgBetaDeviceManagementDeviceConfiguration -DeviceConfigurationId id -Debug
Get-MgBetaDeviceManagementDeviceConfiguration : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Get-MgBetaDeviceManagementDeviceConfiguration -DeviceConfigurationId  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-MgBetaDevic...ceConfiguration], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Get-MgBetaDeviceManagementDeviceConfiguration

Configuration

PS> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.26100.3624
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.3624
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Other information

The issue lies in the definition of the cmdlet. Previously, the parameter definition looked like the following:

[OutputType([System.Boolean], [Microsoft.Graph.Beta.PowerShell.Models.IMicrosoftGraphDeviceConfiguration])]
    [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
    param(
        [Parameter(ParameterSetName='Get', Mandatory)]
        [Microsoft.Graph.Beta.PowerShell.Category('Path')]
        [System.String]
        # The unique identifier of deviceConfiguration
        ${DeviceConfigurationId},

        [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)]
        [Microsoft.Graph.Beta.PowerShell.Category('Path')]
        [Microsoft.Graph.Beta.PowerShell.Models.IDeviceManagementIdentity]
        # Identity Parameter
        # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
        ${InputObject},

        [Alias('Expand')]
        [AllowEmptyCollection()]
        [Microsoft.Graph.Beta.PowerShell.Category('Query')]
        [System.String[]]
        # Expand related entities
        ${ExpandProperty},
...

With 2.27.0, it looks like the following:

[OutputType([System.Boolean], [Microsoft.Graph.Beta.PowerShell.Models.IMicrosoftGraphDeviceConfiguration])]
    [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
    param(
        [Parameter(ParameterSetName='Access', Mandatory)]
        [Parameter(ParameterSetName='AccessExpanded', Mandatory)]
        [Parameter(ParameterSetName='Get', Mandatory)]
        [Microsoft.Graph.Beta.PowerShell.Category('Path')]
        [System.String]
        # The unique identifier of deviceConfiguration
        ${DeviceConfigurationId},

        [Parameter(ParameterSetName='AccessViaIdentity', Mandatory, ValueFromPipeline)]
        [Parameter(ParameterSetName='AccessViaIdentityExpanded', Mandatory, ValueFromPipeline)]
        [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)]
        [Microsoft.Graph.Beta.PowerShell.Category('Path')]
        [Microsoft.Graph.Beta.PowerShell.Models.IDeviceManagementIdentity]
        # Identity Parameter
        # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
        ${InputObject},

        [Parameter(ParameterSetName='Get')]
        [Parameter(ParameterSetName='GetViaIdentity')]
        [Parameter(ParameterSetName='List')]
        [Alias('Expand')]
        [AllowEmptyCollection()]
        [Microsoft.Graph.Beta.PowerShell.Category('Query')]
        [System.String[]]
        # Expand related entities
        ${ExpandProperty},

There are more parameter sets available per parameter, meaning that if only one parameter is specified, the parameter set cannot be resolved because multiple parameter sets could be assigned. Once an additional parameter is specified and the parameter set can be determined, it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions