pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
620 stars 330 forks source link

[BUG] - Manager is not returned from Get-PnPAzureADUser #3939

Open kingy444 opened 2 months ago

kingy444 commented 2 months ago

Reporting an Issue or Missing Feature

When running the below command the Manager value is empty. The equivelent Get-MgUser command returns the manager value Get-PnPAzureADUser -Select Manager -Identity $Identity

Expected behavior

The details of the Manager (ideally including at least the GUID) is returned

Actual behavior

The field is returned under AdditionalProperties, but the property is empty

Steps to reproduce behavior

$Identity = ""
$PnPUser = Get-PnPAzureADUser -Select Manager -Identity $Identity 
$PnPUser.AdditionalProperties

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

2.4.0 and Powershell 7.2

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

wilecoyotegenius commented 1 month ago

Fixing this would require making changes in PnP.Framework - PnP.Framework.Graph.UsersUtility.ListUsers method. Essentially, the issue is that manager is returned only once you add $expand=manager to the query (adding $select is not enough). I will look at this in my spare time and provide a PR.