Get-AzureADUser

In this Azure PowerShell article, we 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.

Syntax

Below is the syntax of the Get-AzureADUser PowerShell command.

Get-AzureADUser
Get-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-AzureADUser

After 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                       : Member

You can see the same output below

Get-AzureADUser

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-ca68b893b6df

After 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                       : Member

You can check out the same output below

Get-AzureADUser Examples

Example-3:

Execute the below PowerShell command that can get you the user details those names start with the specified SearchString.

Connect-AzureAD -TenantId 5d9d690a-0310-474d-ae8b-xxxxxxxxxx28
Get-AzureADUser -SearchString "ts"

After executing the above command, I got the below-expected output

Get-AzureADUser PowerShell

Example-4:

You can use the Filter condition with the Get-AzureADUser PowerShell command. Execute the below PowerShell command to get the user details whose surname is “Sahoo”.

Get-AzureADUser -Filter "Surname eq 'Sahoo'"

After executing the above command, I got the below-expected output.

ObjectId                             DisplayName       UserPrincipalName              
--------                             -----------       -----------------              
54481342-e592-47c2-ba89-b07dcadf9346 Bijay Kumar Sahoo fewlines4biju_hotmail.com#EX...

You can see the same output below

get-azureaduser filter examples

Example-5:

You can use the Get-AzureADUser command to get all properties of all the users like below.

Connect-AzureAD -TenantId 5d9d690a-0310-474d-ae8b-xxxxxxxxxx28
Get-AzureADUser | Select *

After executing the above command, I got the below-expected output

Get-AzureADUser all properties

Check out the below video tutorial on the Get-AzureADUser PowerShell Command.

You may also like to check the following article in case you are getting any issues while executing this command.

Final Thoughts

Well, in this article, we discussed the syntax and usage of the Get-AzureADUser PowerShell command with examples of how to use the Get-AzureADUser command. Thanks for reading this article !!!