Recently I had a use case where a customer uses Windows Virtual Desktop with RemoteApps, and files had to be opened and saved on the user’s OneDrive within these applications. Not a very exceptional situation if you ask me.
I know that with some GPO settings / registry keys you can configure silent sign-in and Files on-demand (recommended within environments like Windows Virtual Desktop). However, when configuring those settings, everything was working fine in a full published desktop, but not in a Windows Virtual Desktop RemoteApp.
When starting a RemoteApp, for example WordPad and open File > Open, OneDrive is visible on the left site, but no account is configured as shown in the screenshot below.
For applications such as Microsoft Word and Microsoft Excel, this is not a problem because OneDrive is built-in, but for all other non-Microsoft Office applications this is really a problem. I searched the internet on forums and found out that a lot of other people are facing the same problems, even within on-premises Citrix environments.
After some searching on the Microsoft and Citrix tech forums and testing I was able to solved the problem by applying the following registry keys via a GPO policy to the Windows Virtual Desktop environment;
For silent Account Config and Files On Demand:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\OneDrive] "SilentAccountConfig"=dword:00000001 "FilesOnDemandEnabled"=dword:00000001
To trigger OneDrive in a RemoteApp:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RailRunonce] "OneDrive"="C:\\Program Files (x86)\\Microsoft OneDrive\\OneDrive.exe /background"
“Magic” key to let it all work, even the first time a user logs in:
After applying all the keys it worked fine, as shown in the screenshot below.
Once again I did not found this solution myself, I found it (in parts) on the Microsoft Tech Community forum, so all kudo’s to @Marcel Biebricher and @racook for providing part of the solution #Community