Firstly, check out the official page
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.