azurepowershellazure-resource-managerazure-powershell

Get list of assigned users in an Azure Virtual Desktop host pool using Powershell


I would like to get a list of users that are assigned to AVD session hosts. There are a few Powershell cmdlets like Get-AzWvdWorkspace and Get-AzWvdHostPool, but I don't see anything that would provide assigned users in the output.

Is there anything that I can use to provide this output without resorting to exporting each host pool in CSV and filtering assigned users within that?


Solution

  • I do agree @theillien, I use the same way as below to get the assigned users and I followed Microsoft-Document:

    $rithsesHosts = Get-AzWvdSessionHost -ResourceGroupName "rithwik" -HostPoolName "rithwiktest"
    foreach ($rith in $rithsesHosts) {
        $rithasUser = $rith.AssignedUser
        Write-Output "Hello Rithwik Bojja!! , Session Host is: $($rith.Name), Assigned Users are: $rithasUser"
    }
    

    Output:

    enter image description here