Sync Azure AD Extension Attribute for Office 365 Custom Property

The discoveries in the field of technology are aimed to improve the overall business function and operations. Microsoft- a leading technology company is consistently working to streamline tasks and optimize processes. Office 365 is a line of subscription services launched by Microsoft in the year 2011. Microsoft has provided a vivid range of new services and features in this cloud-based subscription that is beneficial for most businesses in improving their overall processes.

Most of the organizations have moved their business in a cloud-based subscription with the help of a SharePoint development company and eliminate their on-premise servers to reduce the maintenance cost and move to the cloud. These organizations have local AD servers that need to sync with Azure AD for further use of the server. SharePoint developers are responsible to set sync processes from local AD to Azure AD. In SharePoint On-premise server, an administrator can configure the synchronization process from Active Directory (AD) to the SharePoint User Profile Service Application (UPA). But in SharePoint Online, the process of synchronization is quite different.

Let see, How Office 365 user synchronization pipeline works:

Office 365 user synchronization pipeline

There are four processes in managing user profile synchronization from local active directory to SharePoint Online:

  • Azure AD Connect: Connect syncs data from your On-premise Active Directory to Azure Active Directory.
  • AAD to SPO Sync: Syncs data from Azure Active Directory to SPO directory Store.
  • AD Import: syncs data from the SPO Directory Store to User Profile Service Application.
  • WSS Sync : Syncs data from User Profile Application to the SharePoint Online site collection.

As a part of the synchronization process, the job is handled by a timer and managed by Microsoft, so in that regard, the first question that comes to mind is when will I expect to see my changes in User Profile Application? 

The Answer to this is the changes are processed in batches, and the timer job runs until the changes from the SPO Directory are synced to the User Profile Application. The required time will depend on the number of changes. However, the Service Level Agreement (SLA) states that any change in a user profile in SPO Directory will be reflected within 24 hours in their respective User Profile Service.

The properties are synced by this processing pipeline which is very limited to some predefined properties like UserPrincipalName, DisplayName, telephoneNumber, proxyAddress, Title, Department, PreferredLanguage, etc to guarantee consistent performance of the timer job. Users can see a complete list of properties here. So, if you want to sync custom properties from local AD, the administrator will have to set up a process for the same.

Let’s sync Azure Active Directory extension attribute with SharePoint Online User Profile Service Application custom property

SharePoint developers can sync AD extension attributes with SharePoint Online User Profile Service custom property using PowerShell. Once this property is synced with Azure Active Directory from your local Active Directory, you can write CSOM code with PowerShell to sync properties.

PowerShell script

$appSiteUrl = "<SharePoint Online URL>"
$credential = Get-Credential 
Connect-PnPOnline -Url $appSiteUrl -Credentials $credential
Connect-AzureAD -Credential $credential
$conn = Get-PnPConnection
 
Get-AzureADUser -All $true | ForEach-Object {
    if ($_.ExtensionProperty.ContainsKey("<extension attribute key>")) {
        $adValue = $_.ExtensionProperty.Item("<extension attribute key>")
        Set-PnPUserProfileProperty -Account $_.UserPrincipalName.ToString() -PropertyName "CustomPropertyInternalName" -Value $adValue
    }
}

SharePoint developers can also sync the custom property using PnP-PowerShell commands. You can see we can reduce the code by using PnP-PowerShell script:

PnP-PowerShell script

$appSiteUrl = "<SharePoint Online URL>"
$credential = Get-Credential 
Connect-PnPOnline -Url $appSiteUrl -Credentials $credential
Connect-AzureAD -Credential $credential
$conn = Get-PnPConnection
 
Get-AzureADUser -All $true | ForEach-Object {
    if ($_.ExtensionProperty.ContainsKey("<extension attribute key>")) {
        $adValue = $_.ExtensionProperty.Item("<extension attribute key>")
        Set-PnPUserProfileProperty -Account $_.UserPrincipalName.ToString() -PropertyName "CustomPropertyInternalName" -Value $adValue
    }
}

Conclusion

The unique combination of SharePoint and Microsoft Dynamic 365 helps any SharePoint development company to migrate the user requirements from local Azure AD to SharePoint Online site for future use. By syncing the property from local AD to SharePoint Online User Profile Service custom property. You can also set automation functions in MS Azure to sync property recursively.

profile-image
Shital Patel

Shital Patel is VP at TatvaSoft with a high-level of proficiency and technical precision in SharePoint Development. His experience of the last two decades has helped businesses to solve complex challenges resulting in growth and performance of Startups to Fortune 500 companies.

Related Service

Know more about SharePoint Development services

Learn more Arrow About SharePoint Development

Want to Hire Skilled Developers?

    Comments

    • Leave a message...

    Ready to Build Your Custom Application Solution?

    Tatvasoft is a reputed CMMI level 3 software and mobile app development company. When it comes to software development companies, Tatvasoft strives to be the best.

    Request a Proposal Arrow Icon
    United States Office
    United States +1 503 832 4034
    17304 Preston Road, Suite 800, Dallas, Texas, 75252 +1 503 832 4034
    United Kingdom Office
    United Kingdom +44 742 409 8452
    307, Euston Road,
    London NW1 3AD,
    United Kingdom
    +44 742 409 8452
    Australia Office
    Australia +61 3 9581 2659
    Level 19/180,
    Lonsdale St, Melbourne
    VIC 3000
    +61 3 9581 2659
    Canada Office
    Canada +1 416 567 7664
    4711 Yonge Street,
    10th Floor, Toronto, Ontario, M2N 6K8
    +1 416 567 7664
    Japan Office
    Japan
    902 Pearl Building,
    Miyamae-cho 8-15, Kawasaki-ku,
    Kawasaki-shi, Kanagawa,
    210-0012
    Saudi Office
    Saudi Arabia +966 552 325 560
    6th Floor,
    Al Budoor Tower Prince Mohammed Bin Fahad Road,
    Dammam 34251
    +966 552 325 560
    India Office
    India +91 960 142 1472
    TatvaSoft House,
    Rajpath Club Road, Ahmedabad, Gujarat,
    380054
    1401-1409, RK Empire,
    150 Feet Ring Road,
    Rajkot, Gujarat,
    360004
    +91 960 142 1472