powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Get-PnPAzureADUser fails when -SELECT "Country" is present

Open MrDrSushi opened this issue 4 years ago • 6 comments

Notice

Get-PnPAzureADUser when running inside Azure Automation Account (runbook) or locally on Windows ISE will fails throwing an error "An item with the same key has already been added." - the issue is only seen when selecting more than one column, it works fine when -SELECT is not present

Apparently this issue is only raised when "COUNTRY" is present in the -SELECT parameter, the following example below doesn't raise any error and works inside Azure Runbook or locally on ISE:

   `-SELECT "extension_xxxxemployeeNumber","extension_xxxxemployeeID," `

Reporting an Issue or Missing Feature

This command doesn't works when I'm selecting more than one column in the -SELECT parameter

For example:

Get-PnPAzureADUser -Select "Country","extension_dcc059e063864411939c44db68f7d703_employeeID" fails with the error message: "An item with the same key has already been added."

Error-1-Local Error-2-Azure

Another small variance in -SELECT:

Get-PnPAzureADUser -Select "Country, extension_dcc059e063864411939c44db68f7d703_employeeID" - will not cause an error but will ignore the "Country" field in the result set, the query above will list the the other columns along with contents of "extension_xxxxxemployeeID" but Country

Expected behavior

The command needs to return users with the values for the specified columns in the parameter -SELECT "a","b","c"

Actual behavior

according to the documentation the parameter is meant to be a string and should return the values from the specified columns

Steps to reproduce behavior

  • Create a new Azure Runbook PowerShell, choose runtime version 5.1 or Windows ISE and new file
  • Run the following example:

$users = Get-PnPAzureADUser -Select "country","extension_dcc059e063864411939c44db68f7d703_employeeID"

What is the version of the Cmdlet module you are running?

1.10.0

Which operating system/environment are you running PnP PowerShell on?

  • [X] Windows
  • [ ] Linux
  • [ ] MacOS
  • [ ] Azure Cloud Shell
  • [ ] Azure Functions
  • [X] Other : Azure Automation Account (classic PowerShell environment version 5.1)

MrDrSushi avatar Apr 30 '22 06:04 MrDrSushi

Can you try this on PS 7 or classic PS 5 on windows and let us know ?

gautamdsheth avatar May 05 '22 08:05 gautamdsheth

Can you try this on PS 7 or classic PS 5 on windows and let us know ?

The screenshot from my OP above included the result of a PS 5 result - I'm really not very concerned on local PowerShell, it would be nice to have it fixed but my main concern is where I needed it the most, in the cloud running on Azure Automation Accounts.

It definitely doesn't work inside an Azure Runbook, it doesn't matter whether the runbook runs in the cloud or on a hybrid worker, the error "An item with the same key has already been added." is always present, I've tried Runbook version 5.1 and 7.1 - both respectively fail.

MrDrSushi avatar May 06 '22 23:05 MrDrSushi

anybody reading these???

MrDrSushi avatar May 18 '22 23:05 MrDrSushi

@MrDrSushi - This is a Community driven module. This means we support it on our own personal time, and we also have day jobs. Therefore there's no SLA.

If things are not fast enough for you, you've got other alternatives like the SharePoint Management Shell (Microsoft module), CSOM, or eventually Microsoft Graph.

So, please be mindful and respectful.

veronicageek avatar May 19 '22 18:05 veronicageek

@MrDrSushi - This is a Community driven module. This means we support it on our own personal time, and we also have day jobs. Therefore there's no SLA.

If things are not fast enough for you, you've got other alternatives like the SharePoint Management Shell (Microsoft module), CSOM, or eventually Microsoft Graph.

So, please be mindful and respectful.

It seems you took the time to answer in the worst possible way, seems you were not that busy

MrDrSushi avatar May 20 '22 03:05 MrDrSushi

@MrDrSushi - As you don't seem to understand the Code of Conduct for Open Source nor the Community, we're simply not going to work on your issue.

As a reminder for this repository, we DO NOT TOLERATE this kind of behaviour.

veronicageek avatar May 20 '22 11:05 veronicageek