How to login into Windows VM using Active Directory User Credentials

Megha Mishra
3 min readJul 26, 2023

In this Demo, I will be showing you how we can connect a Windows VM with Azure AD user.

Introduction

The organizations can improve the security level of Windows virtual machines in Microsoft Azure by integrating with Azure Active Directory authentication login. We can use the Azure AD as a core authentication platform to RDP into a Windows Server 2019 Datacenter.

Perquisites :

  1. Azure subscription
  2. Create a Azure AD user — Credentials will be using to login into VM.

In this Demo I will be using the below user to login into Azure VM.

Step- 1: Create a VM with windows image and enable the Login with Azure AD

Step- 2: RBAC Role assignments for Azure AD login

  • Virtual Machine Administrator Login: Users with this role assigned can log in to an Azure virtual machine with administrator privileges.
  • Virtual Machine User Login: Users with this role assigned can log in to an Azure virtual machine with regular user privileges.

Go to IAM → add role Assignment

Search Virtual Machine User Login and then Next.

Select the user whom you want to give access to login into VM and Create.

Step- 3: Run Command DisableNLA

Now Go to VM → Search Run command in left menu → DisableNLA and click on RUN.

Step- 4: Edit the RDP file and Connect the VM with Azure AD user Credentials.

Now Download the RDP file and open with notepad.

Copy below two lines and Add into RDP file and save.

enablecredsspsupport:i:0
authentication level:i:2

File would be looks like this.

Now Double click on RDP file. So, It will show you directly the window as show below and just with your ad user credentials.

BOOM! VM got successfully logged in with AD user Credentials.

Now, Verify the details inside the VM.

Go to Settings → Accounts → Work Account

In this Demo we have successfully Authenticated the VM with Azure AD user Credentials.

--

--