Skip to content

Get-MgBetaDeviceManagementDeviceConfiguration - Wrong cmdlet definition #3295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
FabienTschanz opened this issue Apr 25, 2025 · 1 comment · May be fixed by #3326
Open

Get-MgBetaDeviceManagementDeviceConfiguration - Wrong cmdlet definition #3295

FabienTschanz opened this issue Apr 25, 2025 · 1 comment · May be fixed by #3326
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@FabienTschanz
Copy link

FabienTschanz commented Apr 25, 2025

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.

@FabienTschanz
Copy link
Author

Still appears with 2.28.0. Can somebody please take a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant