Reviewing the latest OneDrive features I wanted to try the new AutoMountTeamSites setting which lets you preconfigure SharePoint online sites to sync automatically for defined users and devices.

Updated on 12.07.2019: Included the Intune administrative template configuration

The setting is officially described as follow:

This setting lets you specify SharePoint team site libraries to sync automatically the next time users sign in to the OneDrive sync client. (Microsoft)

If you enable this setting, the OneDrive sync client will automatically download the contents of the libraries you specified as online-only files the next time the user signs in. The user won’t be able to stop syncing the libraries. (Microsoft)

Prerequisites

In order to get things up an running we need at least:

  • OneDrive sync client version 19.012.0121.0011 or newer
  • Windows 10 Version 1709 or newer
  • OneDrive Files On-Demand enabled (described below)

Be aware that this feature is not supported with on-premises SharePoint sites and not recommended to enable this setting for more than 1'000 devices. The device limit is related to the Windows Push Notification Service which tells the OneDrive clients when a file change occurs on a server side. When you exceed that limit clients will find themselves in a polling mode. Hans Brender explains this behavior well on his blog.

Gathering the SharePoint library ID

We need to gather the SharePoint library ID which is an encoded  HTML URL of your SharePoint library.  To get the library ID navigate to your SharePoint site, click Sync and then Copy library ID.

## Intune Administrative Template configuration

Create a new device configuration profile in Intune and select Administrative Template as type:

  • To find all OneDrive policies enter “OneDrive” as search criteria
  • Look for the “Use OneDrive Files On-Demand” setting and enable it
  • Look for the “configure team site libraries to sync automatically” setting which is available in the machine and user context
  • Enter a friendly Name for your library and paste-in the copied SharePoint library ID from above
  • Please note that the Name property is only used for better recognition of the setting and has no impact on your end devices - where the original name of the SharePoint library will be displayed.

OneDrive Files On-Demand | OneDrive AutoMountTeamSites |

Additional policies

For a better user experience I recommend you to configure the: “Silently sign in users to the OneDrive sync client with their Windows credentials” as well, assuming your devices are Hybrid Azure AD Joined or Azure AD Joined then OneDrive get’s automatically provisioned.

Intune ADMX ingestion (superseded)

Normally I’m a fan of Intune OMA-URI and ADMX Backend Policies to deploy GPO settings with Intune. Unfortunately I had a lot of issues for this setting and kept testing for a long time. I was able to write values into the registry with URL’s like “tech.nicolonsky.ch” but not with encoded SharePoint library ID’s. This resolves to a problem with the Windows 10 client side MDM extension because it cannot process the encoded SharePoint Library ID string.

Registry configuration

Enabling the feature with the Windows registry is quite easy and may be suitable if you cannot use device management capabilities like Intune MDM or Group Policy. We simply need to set a registry key under the following location:

HKLM:\SOFTWARE\Policies\Microsoft\OneDrive\TenantAutoMount

Choose a suitable name (this has no technical impact as the original SharePoint library name is used) as value use the copied SharePoint library ID from above.  

PowerShell snippet

To set the registry key with an (Intune) PowerShell script you can use the following snippet and update it with your values:

End user experience

After the next sign-in it took a few minutes and the SharePoint library was visible on my lab-machine:

Please note that it can take up to 8 hours to apply the setting, as documented by Microsoft.