issue with azure accounts

Hello Experts,

May I know who sets the flag OnPremisesSyncEnabled for AADuser account?

I am seeing some of the accounts are not set with this flag so location details from on-prem AD is not updating in AZURE AD so when 1IM assigns licence to azure AD job is getting frozen with message 

AAD_UserHasSubSku_Provision

ServiceException occured

Code: Request_BadRequest
Message: License assignment cannot be done for user with invalid usage location
Any leads on how can we avoid this issue?
Version 8.1