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 firstname.lastname@example.org 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 email@example.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?