This Azure PowerShell article will discuss the syntax and usage of the Get-AzureADUser PowerShell command with examples.
Get-AzureADUser
The Get-AzureADUser is an excellent Azure PowerShell cmdlet that helps you to get user details from your Azure Active Directory or to get Azure AD user attributes.
Syntax of Get-AzureADUser
Below is the syntax of the Get-AzureADUser PowerShell command.
Get-AzureADUserGet-AzureADUser -ObjectId <String>Get-AzureADUser
[-SearchString <String>]Get-AzureADUser Examples
Well, let’s discuss a few examples of how to use the Get-AzureADUser PowerShell command.
Example-1:
After executing the below PowerShell command, you will get the lists of Azure AD users.
Connect-AzureAD -TenantId 5d9d690a-0310-474d-ae8b-xxxxxxxxxx28
Get-AzureADUserAfter executing the above command, I got the below output
Account Environment TenantId TenantDomai
n
------- ----------- -------- -----------
fewlines4biju@hotmail.com AzureCloud 5d9d690a-0310-474d-ae8b-42df2d549228 fewlines...
ExtensionProperty : {[odata.type, Microsoft.DirectoryServices.User],
[createdDateTime, 12/18/2017 1:38:39 PM],
[employeeId, ], [onPremisesDistinguishedName, ]...}
DeletionTimestamp :
ObjectId : 54481342-e592-47c2-ba89-b07dcadf9346
ObjectType : User
AccountEnabled : True
AgeGroup :
AssignedLicenses : {}
AssignedPlans : {}
City :
CompanyName :
ConsentProvidedForMinor :
Country :
CreationType :
Department : IT
DirSyncEnabled :
DisplayName : Bijay Kumar Sahoo
FacsimileTelephoneNumber :
GivenName : Bijay Kumar
IsCompromised :
ImmutableId :
JobTitle : Manager
LastDirSyncTime :
LegalAgeGroupClassification :
Mail :
MailNickName : fewlines4biju_hotmail.com#EXT#
Mobile :
OnPremisesSecurityIdentifier :
OtherMails : {fewlines4biju@hotmail.com}
PasswordPolicies :
PasswordProfile :
PhysicalDeliveryOfficeName :
PostalCode :
PreferredLanguage :
ProvisionedPlans : {}
ProvisioningErrors : {}
ProxyAddresses : {}
RefreshTokensValidFromDateTime : 12/18/2017 1:38:39 PM
ShowInAddressList :
SignInNames : {}
SipProxyAddress :
State :
StreetAddress :
Surname : Sahoo
TelephoneNumber :
UsageLocation :
UserPrincipalName : fewlines4biju_hotmail.com#EXT#@fewlines4bijuhotmail.o
nmicrosoft.com
UserState :
UserStateChangedOn :
UserType : Member
ExtensionProperty : {[odata.type, Microsoft.DirectoryServices.User],
[createdDateTime, 5/29/2023 7:54:11 AM],
[employeeId, ], [onPremisesDistinguishedName, ]...}
DeletionTimestamp :
ObjectId : 5e013a07-e22a-4d46-a6be-ca68b893b6df
ObjectType : User
AccountEnabled : True
AgeGroup :
AssignedLicenses : {}
AssignedPlans : {}
City :
CompanyName :
ConsentProvidedForMinor :
Country :
CreationType :
Department :
DirSyncEnabled :
DisplayName : tsinfouser
FacsimileTelephoneNumber :
GivenName :
IsCompromised :
ImmutableId :
JobTitle :
LastDirSyncTime :
LegalAgeGroupClassification :
Mail :
MailNickName : tsinfouser
Mobile :
OnPremisesSecurityIdentifier :
OtherMails : {}
PasswordPolicies :
PasswordProfile : class PasswordProfile {
Password:
ForceChangePasswordNextLogin: True
EnforceChangePasswordPolicy: False
}
PhysicalDeliveryOfficeName :
PostalCode :
PreferredLanguage :
ProvisionedPlans : {}
ProvisioningErrors : {}
ProxyAddresses : {}
RefreshTokensValidFromDateTime : 5/29/2023 7:54:11 AM
ShowInAddressList :
SignInNames : {}
SipProxyAddress :
State :
StreetAddress :
Surname :
TelephoneNumber :
UsageLocation :
UserPrincipalName : tsinfouser@fewlines4bijuhotmail.onmicrosoft.com
UserState :
UserStateChangedOn :
UserType : MemberYou can see the same output below

Example-2:
You can execute the below PowerShell command will get you the active directory user with the object ID 5e013a07-e22a-4d46-a6be-ca68b893b6df.
Connect-AzureAD -TenantId 5d9d690a-0310-474d-ae8b-xxxxxxxxxx228
Get-AzureADUser -ObjectId 5e013a07-e22a-4d46-a6be-ca68b893b6dfAfter executing the above PowerShell command, I got the below output
Account Environment TenantId TenantDomai
n
------- ----------- -------- -----------
fewlines4biju@hotmail.com AzureCloud 5d9d690a-0310-474d-ae8b-42df2d549228 fewlines...
ExtensionProperty : {[odata.metadata, https://graph.windows.net/5d9d690a-
0310-474d-ae8b-42df2d549228/$metadata#directoryObject
s/@Element], [odata.type,
Microsoft.DirectoryServices.User], [createdDateTime,
5/29/2023 7:54:11 AM], [employeeId, ]...}
DeletionTimestamp :
ObjectId : 5e013a07-e22a-4d46-a6be-ca68b893b6df
ObjectType : User
AccountEnabled : True
AgeGroup :
AssignedLicenses : {}
AssignedPlans : {}
City :
CompanyName :
ConsentProvidedForMinor :
Country :
CreationType :
Department :
DirSyncEnabled :
DisplayName : tsinfouser
FacsimileTelephoneNumber :
GivenName :
IsCompromised :
ImmutableId :
JobTitle :
LastDirSyncTime :
LegalAgeGroupClassification :
Mail :
MailNickName : tsinfouser
Mobile :
OnPremisesSecurityIdentifier :
OtherMails : {}
PasswordPolicies :
PasswordProfile : class PasswordProfile {
Password:
ForceChangePasswordNextLogin: True
EnforceChangePasswordPolicy: False
}
PhysicalDeliveryOfficeName :
PostalCode :
PreferredLanguage :
ProvisionedPlans : {}
ProvisioningErrors : {}
ProxyAddresses : {}
RefreshTokensValidFromDateTime : 5/29/2023 7:54:11 AM
ShowInAddressList :
SignInNames : {}
SipProxyAddress :
State :
StreetAddress :
Surname :
TelephoneNumber :
UsageLocation :
UserPrincipalName : tsinfouser@fewlines4bijuhotmail.onmicrosoft.com
UserState :
UserStateChangedOn :
UserType : MemberYou can check out the same output below

Example-3:
Execute the PowerShell command below that can give you the user details. Those names start with the specified SearchString.