Thank you for reaching Microsoft Q&A.
I understand that you are trying to use the onPremisesSamAccountName but the attribute is not available with the synced users in the Cross Tenant Synchronization.
In general default Entra Connect Sync rules, the attribute "SamAccountName" gets synced to Entra ID as "onPremisesSamAccountName".
When using cross-tenant synchronization, some attributes may not be available for synchronization. The onPremisesSamAccountName attribute is one of the attributes that cannot be synchronized by cross-tenant synchronization.
To sync the onPremisesSamAccountName attribute in a cross-tenant synchronization setup, you need to ensure that the attribute is included in the synchronization schema.
You may need to extend the schema to include the onPremisesSamAccountName attribute if it’s not available by default.
For more information, please refer the below articles.
https://learn.microsoft.com/en-us/entra/identity/app-provisioning/known-issues?pivots=app-provisioning#attribute-mappings
https://learn.microsoft.com/en-us/entra/identity/app-provisioning/user-provisioning-sync-attributes-for-mapping
Hope this helps. Do let us know if you any further queries by responding in the comments section.
Thanks,
Akhilesh.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.