Please bear with me. I have no experience using AAD/PS.
I am just playing around trying to generate a list of users and their managers.
What I have done is something like this:
$UserId = (Get-AzureADUser -All $true).ObjectId
$bla = foreach ($User in $UserId)
{
write-output $User
Get-AzureADUserManager -ObjectId $User
}
$bla | Out-File "C:\Temp\Test.txt"
I populate $UserId with a users ObjectId and then search manager for that user user the Get-AzureADUserManager.
How can I change it to generate a list that includes the following data:
UsersObjectId UserUPN UserType ManagersObjectId ManagerUPN ManagerUserType
I also want it to include all UserObjectIds that does not have any manager set (include null).
Any ideas how to achieve this?