customer relationships

How to deploy an Azure Virtual Desktop environment using PowerShell

To deploy an Azure Virtual Desktop environment using PowerShell, you need to perform the following steps:

  1. Install the required PowerShell modules:
    • Install-Module -Name Az
    • Install-Module -Name Az.DesktopVirtualization
  2. Connect to your Azure account:
    • Connect-AzAccount
  3. Create a resource group:
    • $resourceGroupName = “YourResourceGroupName”
    • $location = “YourLocation”
    • New-AzResourceGroup -Name $resourceGroupName -Location $location
  4. Create a virtual network:
    • $vnetName = “YourVNetName”
    • $subnetName = “YourSubnetName”
    • $vnet = New-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Location $location -Name $vnetName -AddressPrefix “10.0.0.0/16”
    • $subnet = Add-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix “10.0.0.0/24” -VirtualNetwork $vnet
    • $vnet | Set-AzVirtualNetwork
  5. Create a virtual desktop host pool:
    • $hostPoolName = “YourHostPoolName”
    • $vmNamePrefix = “YourVMNamePrefix”
    • $vmSize = “Standard_DS2_v2”
    • $imageOffer = “Windows-10”
    • $imagePublisher = “MicrosoftWindowsDesktop”
    • $imageSku = “20h2-evd-o365pp”
    • $registrationInfo = New-AzDesktopVirtualizationRegistrationInfo -FileUri “https://rdweb.wvd.microsoft.com/api/arm/feeddiscovery
    • $hostPool = New-AzDesktopVirtualizationHostPool -ResourceGroupName $resourceGroupName -Location $location -Name $hostPoolName -FriendlyName $hostPoolName -VmTemplateImageOffer $imageOffer -VmTemplateImagePublisher $imagePublisher -VmTemplateImageSku $imageSku -VmTemplateNamePrefix $vmNamePrefix -VmTemplateVMSize $vmSize -RegistrationInfo $registrationInfo
  6. Create a workspace:
    • $workspaceName = “YourWorkspaceName”
    • $workspace = New-AzDesktopVirtualizationWorkspace -ResourceGroupName $resourceGroupName -Location $location -Name $workspaceName -FriendlyName $workspaceName
  7. Assign users to the host pool:
    • $userPrincipalNames = @(“user1@example.com“, “user2@example.com“)
    • Add-AzDesktopVirtualizationUser -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -HostPoolName $hostPoolName -UserPrincipalName $userPrincipalNames
  8. Grant the necessary permissions:
    • Grant-AzDesktopVirtualizationAppGroupPermission -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -HostPoolName $hostPoolName -AppGroupName “Desktop Application Group” -Role “Desktop Application Group User”

That’s it! You have now deployed an Azure Virtual Desktop environment using PowerShell. Please note that some parameter values, such as resource group name, location, virtual network details, and user principal names, should be replaced with your specific values.


Got a project that needs expert IT support?

From Linux and Microsoft Server to VMware, networking, and more, our team at CR Tech is here to help.

Get personalized support today and ensure your systems are running at peak performance or make sure that your project turns out to be a successful one!

CONTACT US NOW
one click social media designs