Display Custom Attribute of an Azure AD User in Employee Directory

4/26/2021
Applicable to: Employee Directory

Extension attributes in the on-premise active directory (AD) allow extending directory objects with new attributes. These attributes may be synchronized with Azure AD. Once the attributes are synced, you may display them on the SharePoint site and Microsoft Teams with the Employee Directory web part.

This article describes how to set up the Employee Directory web part to display custom attributes of user object from Azure AD.

Attribute Name

Custom attributes are not named like they are in the on-premises AD, for example, fax. Instead, the custom attribute' name in Azure AD is like below:

extension_{uniqueid}_attributeName

Therefore to use custom attributes, you need to retrieve their names from Azure AD.

Precondition

Additional PowerShell modules are required to interact with the Microsoft 365 environment. Open PowerShell and run the following cmdlets to install MSOnline and AzureAD modules:

Install-Module -Name MSOnline
Install-Module -Name AzureAD

Connect to your environment

Run the Connect-AzureAD cmdlet to connect to your Microsoft 365 environment.

Connect-AzureAD

And sign in with your corporate account.

Connect to Microsoft 365 environment with a corporate account

Connect to Microsoft 365 environment with a corporate account

Getting Custom Attributes

Replace dbadmin@vitextra.onmicrosoft.com with the user login in your Azure AD, which has the necessary attributes, and run the script below.

$userLogin = "dbadmin@vitextra.onmicrosoft.com"
Get-AzureADUser -ObjectId $userLogin | Select -ExpandProperty ExtensionProperty

The result listed extension properties that may be used as custom attributes in the Employee Directory web part.

Extension Property of user object in Azure AD

Extension Property of user object in Azure AD

Web Part Properties

Open the page where the Employee Directory web part is placed in edit mode and go to web part settings, and select Configure under Custom Columns heading:

Web Part Settings

Web Part Settings

Add custom attributes to the list and click Save button.

Custom columns settings

Custom Columns Settings

📝 Note
Both Employee Directory and Employee Directory (Azure AD) have similar settings according to custom user properties.

Once custom attributes are defined, marked as visible of them shows up on the employee details pane:

Employee Details Pane

Employee Details Pane

Publish the page to save changes.

See Also

Share