AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha

Microsoft released AVD reassign unassign a personal Virtual desktop capability, which is Generally Available now. Let’s learn AVD assign to a different user and unassign user options available in Azure portal UI and PowerShell.

It was a pain to unassign and reassign a personal virtual desktop (PVD) since the release of WVD (aka AVD). With the new feature to AVD reassign and unassign for a PVD, you no longer need to delete and recreate a session host VM to remove a user assignment.

You can configure the AVD assignment type of the personal desktop host pool to adjust your AVD (a.k.a Azure Virtual Desktop) environment to better suit your needs. You can also use Rest API and PowerShell to assign PVD to a different user and unassign a user.

Patch My PC

If you are using Intune to manage AVD VMs (Session Hosts) and deploy policies and applications to AVD Personal Virtual Desktops, you will need to be more careful. There are some manual actions or scripted solutions you should look into to make this work. More details are in the below section of this post.

AVD Reassign or Unassign a Personal Virtual Desktop

Let’s understand why AVD reassign and unassign a personal virtual desktop (PVD) is important. I have seen scenarios such as the user moving departments in the organization and needing more powerful SKUs because of performance requirements.

The above are some business cases where you might need to unassign a user from an AVD session host (PVD) and assign it to a different user.

AVD Reassign Unassign a Personal Virtual Desktop
AVD Reassign Unassign a Personal Virtual Desktop

How to Reassign a Personal Virtual Desktop from AVD

Learn how to Reassign a Personal Virtual Desktop from AVD portal UI. This is a straightforward option to reassign a personal virtual desktop session host to a different user. In this scenario, two actions are going to take place.

  • The AVD Session Host will get unassigned from a user.
  • The AVD Session Host will get assigned to a different user.

NOTE! – You can use the following PowerShell command to achieve the same results. Update-AzWvdSessionHost -HostPoolName -Name -ResourceGroupName -AssignedUser -Force

Now, let’s see how to initiate the action of assigning to a different user from the Azure portal. Ensure that there is no active session or no user logged into the session host during this reassign activity.

  • Sign in to the Azure portal at https://portal.azure.com and search with the keyword – Azure Virtual Desktop.
  • Click on Azure Virtual Desktop node and navigate to a Host Pools.
  • Identify the host pool you want to modify user assignment.

Now, it’s time to identify the session host you want to change the assignment (reassign to a different user).

How to Reassign a Personal Virtual Desktop from AVD
How to Reassign a Personal Virtual Desktop from AVD

You will need to select the checkbox next to the session host (PVD VM) that you want to reassign to a different user. Now, the Assignment option will be enabled at the top bar, as shown in the screenshot below.

  • Assignment – Assign to a different user. You can use another method also by clicking on ellipses (three dots) at the end of the session host row.
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha

Search a new user from the right side blade to assign the existing VM (session host). You must select exactly 1 item (user).

  • Search with a different user name.
  • Select one user to assign.
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha

Now, it’s time to select the different users for Session Host (Personal Virtual Desktop) reassignment.

  • Check whether the different user is selected or not.
  • Click on Assign button to complete the assignment.
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha

How to Unassign a Personal Virtual Desktop from AVD

The unassignment of a personal virtual desktop from the AVD portal or using PowerShell. The unassignment of the user from this session host will remove the user assignment. Note that AVD is not responsible for cleaning up user data from the previous user.

Assignment – Unassignment. You can use another method also by clicking on ellipses (three dots) at the end of the session host row. Click on the Unassign button to complete the process.

How to Unassign a Personal Virtual Desktop from AVD
How to Unassign a Personal Virtual Desktop from AVD

Profile Cleanup as part of Reassignment of a Personal Virtual Desktop

Now, let’s understand Microsoft’s warning as part of reassignment activity. This is important to understand. The reassignment activity will not change anything on the personal virtual desktop (Azure VM).

The Profile Cleanup activity must be part of the Reassignment of a Personal Virtual Desktop. This means you will need to have a process to remove the profiles of the previously assigned user. The AVD reassignment won’t remove the profiles from the VM.

Note – that Azure Virtual Desktop is not responsible for cleaning up user data (including profile data) from the previous user. This is important for the FsLogix scenario.

Assign user to session host ‘Session Host’ You are reassigning this VM from user ‘X’ to user ‘Y.’ You have to click on the OK button to complete the AVD reassignment of a personal virtual desktop to a different user.

Profile Cleanup as part of Reassignment of a Personal Virtual Desktop AVD
Profile Cleanup as part of Reassignment of a Personal Virtual Desktop AVD

For example, the profile folders for the previously assigned user won’t get deleted automatically. So it’s better to define an automated process to handle this kind of clean-up activity as part of this feature onboarding process.

AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha

AVD Reassignment of a Personal Virtual Desktop Failed Error?

Did you get Failed to Retrieve users and Assign user to the session host error during the AVD reassignment for a PVD? These errors are because the active session or user is actively logged into the session host.

So you will need to make sure that none of the existing assigned users are logged into the session host, and there are no active sessions.

Failed to Retrieve users – ActivityId: ba237dcb-76a5-4dd3-a55c-1ff80657b56e Error: The current assigned user with PUID, AADTenantId and Name is either in the process of logging on or has an existing session on Session Host.

FIX – Please try again after logging off the existing user session or after waiting until the pending session has been established to log off that user session.

Assign user to the session host – ActivityId: ba237dcb-76a5-4dd3-a55c-1ff80657b64e Error: The current assigned user with PUID, AADTenantId and Name is either in the process of logging on or has an existing session on SessionHost.

FIX – Please try again after logging off the existing user session or after waiting until the pending session has been established to log off that user session.

AVD Reassignment of a Personal Virtual Desktop Failed Error?
AVD Reassignment of a Personal Virtual Desktop Failed Error?

Once the user is logged off from the session host, the issue is fixed. You will need to re-initiate the process explained in the above section of the post, “reassign to a different user.”

AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha

End User Expereience for Previous User

The previously assigned user might get the following error message when the user tries to connect to a virtual desktop and when there are no free session hosts available in the host pool.

We couldn’t connect because there are currently no available resources. Try again later or if this keeps happening, ask your admin or tech support for help.

Read MoreFIX Not Able to Connect to AVD Personal Desktop VM Issue Error 0x3000046

AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha

New User Experience of Reassigned User

The New User Experience of Reassigned User is explained in this post section. If you manage personal virtual desktops or AVD with Intune, the user might need to go through the user enrollment process.

However, there would be chances of enrollment failures if the reassigned user has a different set of user policies assigned than the previously assigned user. This is because of the reason related to primary user assignment (more details in the below section).

NOTE! – The new user profile folder (under C:\Users folder in Windows 10 and Windows 11) will also get created as part of the login process as expected.

Related Post Disable Intune ESP FirstSync Registry Entries Event Logs for AVD Windows 365

AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha

Company Portal Issues After Reassignment of an AVD Personal Virtual Desktop

Now, let’s check Company Portal issues after reassigning an AVD Personal Virtual Desktop to a different user. Intune management will not work as expected after assigning another user to VM (Assigned to a Different user).

When the new user logs in to the VM already assigned to a different primary user, the Intune Company portal will not show the assigned applications, installed apps, etc.

NOTE! – You will need to fix this issue by reassigning the new primary user to that VM from the MEM admin center or Intune portal (endpoint.microsoft.com)

Company portal error because of primary user issue – This device is already assigned to someone in your organization. Contact company support about becoming the primary user. You can continue to use the Company portal, but functionality will be limited.

Company Portal Issues After Reassignment of an AVD Personal Virtual Desktop
Company Portal Issues After Reassignment of an AVD Personal Virtual Desktop

Change Primary User for AVD Personal Virtual Desktop

You can change the primary user for the AVD Personal Virtual Desktop (PVD) from the MEM admin center portal. First of all, let’s understand where you can find the primary user details in the MEM admin center.

You can log in to the Endpoint.Microsoft.com portal, Navigate to Devices – Windows – Search for the VM you want to check. Click on the VM record from the search results. Navigate to Properties of the VM to get the details of the Primary user assigned to the VM.

The primary user of the AVD session host or VM has not changed automatically as part reassignment action done on the AVD Azure portal, as explained in the above section. Unless and until you have the new user as the primary user, Intune won’t deploy user policies.

Change Primary User for AVD Personal Virtual Desktop
Change Primary User for AVD Personal Virtual Desktop

Now, let’s check how to change the primary user of the AVD session host from the MEM admin center. And follow the steps explained below.

  • Login to Endpoint.Microsoft.com portal.
  • Navigate to DevicesWindowsSearch for the VM that you want to check.
  • Click on the VM record from the search results.
  • Navigate to Properties of the VM and scroll down until you see Change Primary User button.
Change Primary User for AVD Personal Virtual Desktop
Change Primary User for AVD Personal Virtual Desktop

The right side blade will prompt you to select the new primary user using the select primary user search box. Click on the Select button to continue.

AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha 1

Now, click on the SAVE button to complete the process of changing the primary user.

AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha

Results – AVD Reassign Unassign a Personal Virtual Desktop

After all the above changes, the Intune user based policies and company portal started working as expected. So, it seems you will need to put in some process to complete the end to end process of AVD Reassign & Unassign a Personal Virtual Desktop from AVD portal/PowerShell.

  • Process to cleanup old user profile data.
  • Process to re-assign/change primary user.

NOTE! – You can use PowerShell or Graph API to automate these processes.

AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha 2
AVD Reassign Unassign a Personal Virtual Desktop Options and Intune Primary User Gotcha 19

Author

Anoop is Microsoft MVP! He is a Device Management Admin with more than 20 years of experience (calculation done in 2021) in IT. He is Blogger, Speaker, and Local User Group HTMD Community leader. His main focus is on Device Management technologies like SCCM 2012, Current Branch, and Intune. He writes about ConfigMgr, Windows 11, Windows 10, Azure AD, Microsoft Intune, Windows 365, AVD, etc.

Categories AVD

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.