How to prevent multiple users from simultaneously accessing an Azure VM?

We created a VM as a replacement for physical machine with rarely used software on it.

When I tested it I noticed when a second user accesses the VM, the first user is kicked out and sees the message "You have been disconnected because another connection was made to the remote computer". However, on another VM that wasn't set up by me, I'm getting the warning "Another user is signed in. If you continue, they’ll be disconnected. Do you want to sign in any way?"

What VM or Windows setting(s) do I need to change to display the "Another user is signed in. If you continue, they’ll be disconnected. Do you want to sign in any way?" message on the new VM?


Solution 1:

The answer and comments from Sam are quite right, you need to separate users with different login names; and you are violating the license by running Windows 10 Pro on Azure.

One current, supported, and validly licensed method for doing this is to deploy Azure Virtual Desktop. AVD provides a managed Azure service that combines remote desktop gateway and remote desktop host services with a Windows 10 edition built and licensed for concurrent use by multiple users. If you are familiar with Remote Desktop Serivces or Citrix on servers, this is a similar offering based on Windows 10.

In an AVD scenario both users (and many more) can login to the same Windows 10 machine at the same time without getting kicked out by other users or otherwise prompted during login. In general AVD users are unaware that another user is concurrently using the same machine. AVD requires a license per-user generally from a Microsoft 365 E3/E5 monthly license subscription.

Azure Virtual Desktop documentation

  • Create a full desktop virtualization environment in your Azure subscription without running any gateway servers.
  • Publish as many host pools as you need to accommodate your diverse workloads.
  • Bring your own image for production workloads or test from the Azure Gallery.
  • Reduce costs with pooled, multi-session resources. With the new Windows 10 Enterprise multi-session capability, exclusive to Azure Virtual Desktop and Remote Desktop Session Host (RDSH) role on Windows Server, you can greatly reduce the number of virtual machines and operating system (OS) overhead while still providing the same resources to your users.
  • Provide individual ownership through personal (persistent) desktops.

Solution 2:

By default a Windows VM in Azure is configured for remote administration, which allows up to 2 users to access the machine to undertake remote administration of that machine. If a third user attempts to connect you will see this message. you will see this if a user has disconnected, but not logged off so their session is till running and using a slot.

If you need more than 2 users to access it concurrently, or you are doing more than remote administration then you need to purchase remote desktop client access licences (CAL's) and setup a licence server.