For my task I'm using locally persisted data. Until now I've successfully used Path.GetTempPath()
to get temp folder and persist data there and perform some computations. The temp folder is on the system drive which is not big enough (around 30GB). I'm using VM with 1000GB HDD.
I'd like to write data to the big C:\ drive instead, but it throws an exception:
Access to the path 'C:\whatever_the_path_is' is denied.
when I try to access it.
I see that the tasks run under PoolNonAdmin[some-digits]
user that obviously doesn't have sufficient permissions.
Are there any special APIs to use local storage with Azure Batch tasks?
EDIT: I'm familiar with %AZ_BATCH_NODE_SHARED_DIR%
but for specific reasons I can't use it.
I've found a solution here: https://learn.microsoft.com/en-us/azure/batch/batch-user-accounts
In my case, it was to assign the task elevated UserIdentity like this:
task.UserIdentity = new UserIdentity(new AutoUserSpecification(elevationLevel: ElevationLevel.Admin, scope: AutoUserScope.Pool));