powershell icon indicating copy to clipboard operation
powershell copied to clipboard

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

Open kingy444 opened this issue 9 months ago • 1 comments

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?

  • [x] Windows
  • [ ] Linux
  • [ ] MacOS
  • [x] Azure Cloud Shell
  • [ ] Azure Functions
  • [ ] Other : please specify

kingy444 avatar May 07 '24 01:05 kingy444

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.

wilecoyotegenius avatar May 08 '24 11:05 wilecoyotegenius