Search code examples
azure-active-directoryvirtual-machinevirtual-desktop

Connect to Virtual Machine using AAD Account


I am unable to login my office 365 account on my virtual machine. This my logs when I run dsregcmd /status on cmd.

I tried to edit the VM using this command, still not working. enablecredsspsupport:i:0 authentication level:i:2

Also, I added Role assignment: Virtual Machine Administrator Login and Virtual Machine User Login

And I have this on my extension: AADLoginForWindows


Solution

  • I tried to reproduce the same in my environment and got the results like below:

    While creating virtual machine in management Make sure to check login with Azure Ad like below:

    enter image description here

    In your virtual machine check whether extension is added:

    enter image description here

    Try to assign role assignment Virtual Machine User Login or Virtual Machine Administrator Login to user

    Now, Download Rdp file and login. When I tried to check with dsregcmd /status Azure AD joined successfully:

    enter image description here

    To Login with Azure Ad credentials account try to change Network Level Authentication access in RDP to avoid an error:

    In RDP -> search box type allows remote connection to this computer -> uncheck the box like below:

    enter image description here

    Now edit your RDP downloaded file, try to include

    enablecredsspsupport:i:0
    authentication level:i:2
    username:s:xxxxx.onmicrosoft.com (Add your username here)
    domain:s:AzureAD
    

    enter image description here

    When I try to connect with login AzureAd\UPN with user it connected successfully like below:

    enter image description here