Concepts

Microsoft Azure Virtual Desktop allows you to assign and unassign personal desktops for users. This can be done through PowerShell cmdlets or the Azure portal. In this article, we will guide you through the process of configuring and operating personal desktops for your users.

Assigning Personal Desktops using PowerShell

  1. Start by launching PowerShell with administrative privileges.
  2. Install the Azure PowerShell module if you haven’t already done so, by running the following command:

Install-Module -Name Az.OperationalInsights -AllowClobber -Force

  1. Connect to your Azure account by running the following command:

Connect-AzAccount

  1. Create a virtual machine to serve as the personal desktop template. Specify the necessary configurations such as the virtual machine size, image, and other properties. For example:

$vmName = "MyDesktopVM"
$adminUser = "adminuser"
$adminPassword = ConvertTo-SecureString -String "AdminPassword123!" -AsPlainText -Force
$location = "East US"

$vmConfig = New-AzVMConfig -VMName $vmName -VMSize "Standard_D2s_v3"
$vmConfig = Set-AzVMOperatingSystem -VM $vmConfig -Windows -ComputerName $vmName -Credential (New-Object System.Management.Automation.PSCredential $adminUser, $adminPassword) -ProvisionVMAgent -EnableAutoUpdate
$vmConfig = Set-AzVMSourceImage -VM $vmConfig -PublisherName "MicrosoftWindowsDesktop" -Offer "Windows-10" -Skus "19h2-pro" -Version "latest"
$vmConfig = Set-AzVMOSDisk -VM $vmConfig -Name "$vmName-C-OSDisk" -VhdUri $osDiskUri -CreateOption FromImage -SourceImageUri $sourceImageUri -Windows

$vm = New-AzVM -ResourceGroupName "MyResourceGroup" -Location $location -VM $vmConfig

  1. Generalize and capture the virtual machine image to be used for personal desktops:

Set-AzVM -ResourceGroupName "MyResourceGroup" -Name $vmName -Generalized
Set-AzVm -ResourceGroupName "MyResourceGroup" -Name $vmName -Capture -DestinationContainerName "mycontainer" -VHDNamePrefix "image" -Overwrite

  1. Create a host pool for personal desktops by running the following command:

New-AzDesktopHostPool -TenantId "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -ResourceGroupName "MyResourceGroup" -HostPoolName "MyHostPool" -Location "East US" -FriendlyName "MyHostPool" -MaxSessionLimit 10 -LoadBalancerType BreadthFirst

  1. Assign a user to a personal desktop within the host pool:

Add-AzUserAssignedDesktop -TenantId "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -ResourceGroupName "MyResourceGroup" -HostPoolName "MyHostPool" -UserPrincipalName "user@contoso.com" -RegistrationInfo (New-AzDesktop RegistrationInfo -PersonalVirtualDesktopAssignment -VirtualMachineId "/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachines/")

Unassigning Personal Desktops using Azure portal

  1. Open the Azure portal (https://portal.azure.com) and navigate to your Azure Virtual Desktop resource.
  2. In the left menu, click on “Host pools” and select the host pool containing the personal desktop you want to unassign.
  3. Under the “User assignments” tab, select the user assignment you wish to remove.
  4. Click on the “Remove” button and confirm the action when prompted.

By following these steps, you can easily assign and unassign personal desktops for users in Microsoft Azure Virtual Desktop. You can automate these processes using scripts or integrate them with your existing infrastructure management tools to streamline user management in your environment.

Answer the Questions in Comment Section

Which PowerShell cmdlet is used to assign a personal desktop to a user in Azure Virtual Desktop?

a) Set-AzVirtualDesktop

b) Assign-AzVirtualDesktop

c) Add-AzVirtualDesktopUser

d) New-AzVirtualDesktopUser

Correct answer: c) Add-AzVirtualDesktopUser

True or False: When assigning a personal desktop to a user, the user must already have an Azure Active Directory (AAD) account.

Correct answer: True

How can you unassign a personal desktop from a user in Azure Virtual Desktop?

a) Remove-AzVirtualDesktop

b) Revoke-AzVirtualDesktopUser

c) Disable-AzVirtualDesktopUser

d) Remove-AzVirtualDesktopUser

Correct answer: d) Remove-AzVirtualDesktopUser

True or False: When unassigning a personal desktop from a user, the user’s data on the desktop is permanently deleted.

Correct answer: False

Which user assignment type is available in Azure Virtual Desktop?

a) Random Assignment

b) Pooled Assignment

c) Exclusive Assignment

d) Shared Assignment

Correct answer: b) Pooled Assignment

True or False: Personal desktops in Azure Virtual Desktop can only be assigned to individual users and not to groups.

Correct answer: False

What is the maximum number of personal desktops that can be assigned to a single user in Azure Virtual Desktop?

a) 1

b) 5

c) 10

d) Unlimited

Correct answer: d) Unlimited

True or False: Personal desktop assignments can be managed using the Azure portal, PowerShell, or the Azure Virtual Desktop REST API.

Correct answer: True

Which PowerShell cmdlet is used to retrieve the list of assigned personal desktops for a user in Azure Virtual Desktop?

a) Get-AzVirtualDesktop

b) Fetch-AzVirtualDesktop

c) Get-AzVirtualDesktopUser

d) Retrieve-AzVirtualDesktopUser

Correct answer: c) Get-AzVirtualDesktopUser

True or False: By default, users can unassign their own personal desktops in Azure Virtual Desktop.

Correct answer: False

0 0 votes
Article Rating
Subscribe
Notify of
guest
35 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Cohen Moore
1 year ago

Does anyone know the best practices for assigning personal desktops to users in Azure Virtual Desktop?

Brittany Miller
1 year ago

I’m having trouble unassigning a desktop from a user. Can anyone help?

Sergio Ross
1 year ago

Great blog post, very informative!

Isabelle Fitzsimmons

What are some common issues faced while assigning desktops in AVD?

سینا احمدی

Can multiple users be assigned the same desktop in AVD?

Elif Tütüncü

Great post on AZ-140! I just completed the section on assigning personal desktops. Does anyone have tips for handling multiple assignments efficiently?

Hermannes Janson
1 year ago

Using PowerShell scripts can significantly speed up the process. Have you tried that?

هلیا سالاری

Azure CLI has some useful commands too. It might be worth exploring!

Merlijn Bronswijk
1 year ago

I appreciate the detailed guide, really helped me understand the unassignment process.

Sam Dahl
1 year ago

When you unassign a desktop, what happens to the user’s data? Does anyone know if it’s backed up automatically?

Carla Wells
11 months ago
Reply to  Sam Dahl

The user data usually resides in a profile container like FSLogix. So, unless you delete the container, the data should remain intact.

Arnold Wieser
5 months ago
Reply to  Sam Dahl

Make sure to configure proper backup for FSLogix containers to avoid losing data.

35
0
Would love your thoughts, please comment.x
()
x