Good day,
I have found a strange bug where Parametersetname don’t work as intended when endpoint Authentication is enabled. Having the following endpoint with this SetNames.
param(
[Parameter(Mandatory = $false, ParameterSetName = 'Folder')]
[Parameter(Mandatory = $false, ParameterSetName = 'Item')]
[string]$InstanceId,
[Parameter(Mandatory = $true, ParameterSetName = 'Folder')]
[Parameter(Mandatory = $true, ParameterSetName = 'Item')]
[ValidateSet('Folder', 'Item', IgnoreCase = $true)]
[string]$Object,
[Parameter(Mandatory = $true, ParameterSetName = 'Folder')]
[string]$Name,
[Parameter(Mandatory = $true, ParameterSetName = 'Item')]
[string]$FolderId,
[Parameter(Mandatory = $true, ParameterSetName = 'Item')]
[string]$Note,
[Parameter(Mandatory = $false, ParameterSetName = 'Item')]
[string]$UserName = 'admin',
[Parameter(Mandatory = $false, ParameterSetName = 'Item')]
[int]$PWLength = 16,
[Parameter(Mandatory = $false, ParameterSetName = 'Item')]
[ValidateSet('ul', 'uln', 'ulns', IgnoreCase = $true)]
[string]$PWStrength = 'ulns'
)
Calling https://server/api/?Object=Item&FolderId=Test&Note=Test&PWLength=25
will succeed with the proper respons, however
https://server/api?Object=Folder&Name=Test
will throw error
Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.
These Parameters should work as I have tested them also in a simple Function outside PSU.
Also, this works when endpoint authentication is disabled for this endpoint.
Any help would be appreciated
regards
Elmar
Product: PowerShell Universal
Version: 3.5.4