Enable Win32/NTFS long paths by default in all Windows images that support it
The group policy option "Enable Win32 long paths" is not enabled in the standard Windows Server 2016 Datacenter image for Azure Batch. This is problematic since Batch has quite a deep folder hierarchy for task folders and application packages, hitting 260 characters easily. I don't think there are any downsides in enabling this by default, and it would remove common headaches.
Side note: I wanted to use the Data Science VM image (a Batch adaptation I assume) but this is still at Windows Server 2012 which doesn't have the long paths option.
Are you experiencing this with Azure Batch tasks proper? Internally, Azure Batch uses Universal Naming Convention for file paths on Windows, so you shouldn't observe this issue in task execution (outside of the process execution logic itself).
Otherwise, the recommendation is to enable group policies that you need via a start task.
Marketplace VM images are not controlled by Batch unless our team publishes the VM images. DSVM images are not published by Batch.
I experienced this with the standard Windows Server 2016 image during extraction of an app package. We're currently trying to work around it by changing the relevant registry key within the start task and doing a reboot. A reboot is required since the new registry key only applies to new processes and the Batch agent that decompresses app packages in regular tasks would be the same process that ran the start task.
We'll need to get our team to understand why this is happening in your scenario. Can you create a Portal support incident with a repro? If you can issue an upload service logs request and attach these log files to your support ticket, it would be of great help.
As a potential workaround, is it possible to capture a VM with the relevant registry policy applied and use a custom image to provision your pool? That would avoid the restart cost.
Regarding enablement of this policy, this is something we could explore adding as a feature to the API for Windows pool configurations.
I've already created a support incident last week, the latest status from Monday is that the support has to check with the "Batch Product Group". The issue is really quite simple, just create a zip file which has folder/file paths longer than 240 characters or so and try to use that zip file as app package. The location where Batch tries to extract it to already has a length of 30 or more, so this then exceeds 260 easily and leads to the mentioned issue.
Thanks for the info, we can investigate further.