Hello @Mohammad Haneef , to join a Windows Server machine to Azure AD you need to install Login with Azure AD extension. The "An active directory domain controller" error encountered happens when attempting to join it to an Active Directory, the on-premise version.
Let us know if you need additional assistance. If the answer was helpful, please accept it and rate it so that others facing a similar issue can easily find a solution.