Hi @PAYAL GUPTA,
Ensure user method in SharePoint Online checks if the given user account is valid and then adds the user object to the “User Information List”. And when you grant permission to an Active Directory group, the group will be added to the user information list but users in the group will not be added until they access the site collection.
These users will not exist in the User Information List before you excute ensure user method. As aworkaround we can grant permission to users instead of groups then they will be added to user information list without login.
References:
https://social.technet.microsoft.com/Forums/en-US/3bf1d0f4-4b6e-449b-ab28-8e69ec26cccd/how-to-add-users-automatically-to-users-information-list-in-sharepoint-2013-without-manual-work?forum=sharepointadmin
https://sharepointdiv.wordpress.com/2018/04/09/user-information-list-in-sharepoint-all-details/
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.