question

MirceaD-8889 avatar image
0 Votes"
MirceaD-8889 asked AmitaMenon-3691 edited

Getting current logged in user in Windows Virtual Desktop (WVD)


Having an Azure AD user logged in in a Windows Virtual Desktop (WVD) windows-client and a .NET application launched from this WVD, is it possible to read, from the C# code, the authenticated user in WVD (or a Token)?

Maybe an equivalent for System.Security.Principal.WindowsIdentity.GetCurrent()

The idea is to get a Token ID associated with the Azure user's Object ID.

azure-virtual-desktop
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered whoward-msft commented

It's possible to get all the user sessions via PowerShell cmdlet. Maybe this helps.

 import-module az
 $subID = "xxxxxxxx"
 $resgroup = "xxyz-rg"
 $hostpoolName = "myHostpool"
    
 Get-AzWvdUserSession -SubscriptionId $SubID -ResourceGroupName $resgroup -HostPoolName $hostpoolName | select Name, UserPrincipalName



(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank for your quick response and it seemed promising, but executing it, I get no result (and no error).

0 Votes 0 ·

not even the headers' names (Name Type).

33520-get-azwvdusersession.png


0 Votes 0 ·

But there are active user sessions on the hostpool VMs?

0 Votes 0 ·
Show more comments