Get-AzADUser no longer return Department and AccountEnabled

Viewed 700

I'm pretty sure that last week I was able to use Get-AzADUser to return both Department and AccountEnabled.

Get-AzADUser | where {$_.Mail -eq "abc@xyz.com"} | Select-Object Mail, Department, AccountEnabled

Mail        Department AccountEnabled
----        ---------- --------------
abc@xyz.com 

When I call up all parameters for a single user I can see that I'm missing content on many fields, I basically only see Name, JobTitle, Mail, and MobileNumber

I'm using an account assigned the roles "Global reader" and "Directory readers".

(Other parts of my script also stopped working since last week where Get-AzADUsers no longer has a field called "ObjectId" but instead the field is simply called "Id")

2 Answers

You need to use "-Select" and " -AppendSelected" parameters to get the info.

Try the following (working for me)...

Get-AzADUser -Select 'Department,AccountEnabled' -AppendSelected -UserPrincipalName "abc@xyz.com" | Select-Object Mail, Department, AccountEnabled


Mail          Department    AccountEnabled
----          ----------    --------------
abc@xyz.com   IT Support    True

More info: https://docs.microsoft.com/en-us/powershell/module/az.resources/get-azaduser

I tested in My Environment and found Get-AzADUser not much suitable command as it doesn't appear to return any information about the user (like department, usage location, office info, or basically any properties on the user).

There continues to be a lack of properties returned when comparing Get-AzureADUser vs. Get-AzADUser:

enter image description here

enter image description here

AzureAD Module which is a designed for tasks within AzureAD Where second one Az which is designed to handle most, if not all of Azure's resources.

you can use the az module easliy if you just want to look up the users existance, but if you need to actually administer azure ad i would suggest you go for azuread. To connect to a specified tenant with azuread use connect-azuread -tenantId 'XXXXXX'.

Output Using Get-AzureADUser

I am able to get the departmentName

enter image description here

Reference : https://github.com/Azure/azure-powershell/issues/10497

Related