SOLVED
Home

How to get the original On-Prem AD account into Azure AD & SharePoint Online?

%3CLINGO-SUB%20id%3D%22lingo-sub-335474%22%20slang%3D%22en-US%22%3EHow%20to%20get%20the%20original%20On-Prem%20AD%20account%20into%20Azure%20AD%20%26amp%3B%20SharePoint%20Online%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-335474%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22lia-quilt-row%20lia-quilt-row-header%22%3E%3CDIV%20class%3D%22lia-quilt-column%20lia-quilt-column-24%20lia-quilt-column-single%20lia-quilt-column-common-header%22%3E%3CDIV%20class%3D%22lia-quilt-column-alley%20lia-quilt-column-alley-single%22%3E%3CDIV%20class%3D%22lia-quilt%20lia-quilt-forum-topic-header%20lia-quilt-layout-topic-header%20lia-component-quilt-forum-topic-header%22%3E%3CDIV%20class%3D%22lia-quilt-row%20lia-quilt-row-topic-header%22%3E%3CDIV%20class%3D%22lia-quilt-column%20lia-quilt-column-22%20lia-quilt-column-left%20lia-quilt-column-topic-header-left%22%3E%3CDIV%20class%3D%22lia-quilt-column-alley%20lia-quilt-column-alley-left%22%3E%3CP%3EHello%3C%2FP%3E%3CP%3EWe%20have%20OnPrem%20AD%20where%20our%20users%20accounts%20are%20i.e.%26nbsp%3B%20Domain%5CABC123%26nbsp%3B%20then%2C%20We%20got%20Azure%20AD%2C%20ADFS%2C%20and%20O365%20where%20our%20users%20now%20use%20xxx%40domain.com%20to%20connect%20and%20use%20SharePoint%20Online.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20We%20now%20have%20a%20requirement%20in%20some%20custom%20solution%20in%20SharePoint%20Online%20to%20get%20the%20original%20On-Prem%20AD%20account%20value%20-%20How%20to%20do%20so%3F%20I%20mean%2C%20If%20the%20logged%20user%20is%26nbsp%3Bxxx%40domain.com%2C%20How%20can%20I%20find%20out%20what%20is%20his%20original%26nbsp%3BOn-Prem%20AD%20account%20value%20e.g.%26nbsp%3BDomain%5Cxyz987%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20do%20so%3F%20Or%2C%20How%20can%20I%20sync%20that%20value%20into%20Azure%20AD%20or%20SharePoint%20Profile%3F%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-335474%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20AD%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-338290%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20the%20original%20On-Prem%20AD%20account%20into%20Azure%20AD%20%26amp%3B%20SharePoint%20Online%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-338290%22%20slang%3D%22en-US%22%3EOk!%20AFAIK%20this%20must%20be%20done%20programmatically!%20Powershell%20can%20be%20used%20as%20well%20but%20I%E2%80%99m%20not%20sure%20that%20will%20suit%20your%20needs%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-338288%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20the%20original%20On-Prem%20AD%20account%20into%20Azure%20AD%20%26amp%3B%20SharePoint%20Online%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-338288%22%20slang%3D%22en-US%22%3E%3CP%3EWhile%20the%20SamAccountName%20is%20synced%20to%20Azure%20AD%2C%20it's%20NOT%20exposed%20in%20any%20of%20the%20admin%20centers%20or%20other%20tools.%20You%20can%20only%20consume%20it%20via%20the%20Graph%3A%20%3CA%20href%3D%22https%3A%2F%2Fsocial.msdn.microsoft.com%2FForums%2Fen-US%2Fe400c1c8-c803-4af1-8a90-0a1ff246f844%2Fsamaccountname-attribute-in-azure-ad%3Fforum%3DWindowsAzureAD%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsocial.msdn.microsoft.com%2FForums%2Fen-US%2Fe400c1c8-c803-4af1-8a90-0a1ff246f844%2Fsamaccountname-attribute-in-azure-ad%3Fforum%3DWindowsAzureAD%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-335645%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20the%20original%20On-Prem%20AD%20account%20into%20Azure%20AD%20%26amp%3B%20SharePoint%20Online%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-335645%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Adam%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20On-Prem%20AD%20account%20is%20actually%26nbsp%3B%20Domain%5CMaLa23264%20and%20it%20work%20perfectly%20fine%20with%20our%20internal%20onPrem%20systems%20including%20our%20old%20SharePoint%202013%20on-Prem%20farm.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20SharePoint%20Online%2C%20I%20use%20the%20UPN%20(Mary.Larson%40Domain.com)%2C%20So%2C%20They%20are%20not%20the%20same.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20specific%20SharePoint%20solution%20we%20are%20building%2C%20I%20really%20need%20to%20get%20the%20original%20On-Prem%20AD%20account%20which%20is%26nbsp%3BDomain%5CMaLa23264%20...%20How%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-335479%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20the%20original%20On-Prem%20AD%20account%20into%20Azure%20AD%20%26amp%3B%20SharePoint%20Online%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-335479%22%20slang%3D%22en-US%22%3ECan%E2%80%99t%20see%20why%20the%20samaccount%20name%20is%20needed%3F%20The%20users%20UPN%20should%20be%20set%20and%20be%20the%20same%20in%20AD%20as%20in%20AAD%3C%2FLINGO-BODY%3E
Mary20_19
New Contributor

Hello

We have OnPrem AD where our users accounts are i.e.  Domain\ABC123  then, We got Azure AD, ADFS, and O365 where our users now use xxx@domain.com to connect and use SharePoint Online.

 

However, We now have a requirement in some custom solution in SharePoint Online to get the original On-Prem AD account value - How to do so? I mean, If the logged user is xxx@domain.com, How can I find out what is his original On-Prem AD account value e.g. Domain\xyz987

 

Is there a way to do so? Or, How can I sync that value into Azure AD or SharePoint Profile?

4 Replies
Can’t see why the samaccount name is needed? The users UPN should be set and be the same in AD as in AAD

Hi Adam,

 

My On-Prem AD account is actually  Domain\MaLa23264 and it work perfectly fine with our internal onPrem systems including our old SharePoint 2013 on-Prem farm.

 

In SharePoint Online, I use the UPN (Mary.Larson@Domain.com), So, They are not the same.

 

In specific SharePoint solution we are building, I really need to get the original On-Prem AD account which is Domain\MaLa23264 ... How?

Solution

While the SamAccountName is synced to Azure AD, it's NOT exposed in any of the admin centers or other tools. You can only consume it via the Graph: https://social.msdn.microsoft.com/Forums/en-US/e400c1c8-c803-4af1-8a90-0a1ff246f844/samaccountname-a...

Ok! AFAIK this must be done programmatically! Powershell can be used as well but I’m not sure that will suit your needs
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
30 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies