Hello Khalil Mejri,
Thank you for posting in Microsoft Community forum.
Would you please provide the full message about error "The logon attempt failed" or the screenshot about error "The logon attempt failed"?
So you can sign in the domain machine locally?
What account did you use to sign in (AD domain admin account or AD domain user account)?
If you have any question or concern, please feel free to let us know.
Best Regards,
Daisy Zhou