Firstly, check out the official page
https://docs.microsoft.com/en-us/windows/client-management/connect-to-remote-aadj-pc
Pay special attention to the following:
When you connect to the remote PC, enter your account name in this format: AzureAD UPN
. The local PC must either be domain-joined or Azure AD-joined. The local PC and remote PC must be in the same Azure AD tenant.