run-windows-service-within-docker-with-external-account

Hi,
This is the situation.

We have EKS, Local VMs and local NFS share (\nfs-share). They are connected with Transit gateway. Local machines has an account “lab\test” (not sure if it is in AD or local), which has full access to NFS. What I need is to have possibility to write data from EKS into NFS through Local VMs. it is possible, when I’m manually setting credentials in EKS pod, everything works as expected. But when I’m running a service in EKS which should write data, I cannot assign for it credentials, because it is running in a docker container.

Dockerfile is based on mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2019 image. I need to have some powershell commands which will create service, run it as “lab\test” account, somehow authenticate into NFS and write there data.

THis is how I’m creating service:
New-Service -Name ‘SERVICEt’ -BinaryPathName ‘C:\app\SERVICE.exe’ -DisplayName ‘SERVICE’ -StartupType Automatic -Credential $Credential

WHen I starting this service it shows “Access Denied” while trying to write data.

What can be used here?

Sorry … dont have an answer/link for you but I did see this in another docker question post:

Sometimes it gets complicated when you have to deal with ports/folder mapping, passing stuff through 2 layers is often the culprit of services not working correctly.

I’m sorry, can you clarify if you are getting “Access Denied” while starting the service or later when you’re attempting to write the data?

I also think we do not have enough information. What is service.exe? What does “manually setting credentials in EKS pod” actually mean/look like? Does that mean you are running service.exe interactively?

Service itself should write data, so I’m getting Access Denied after starting.
Service.exe is a service which is creating logs and some data in NFS storage.
“Manually setting credentials” means when I’m not trying to data write with service.exe, but logging into NFS manually, like:
$securePassword = ConvertTo-SecureString $Env:password -AsPlainText -Force;
$credential = New-Object System.Management.Automation.PSCredential ($Env:username, $securePassword);
New-PSDrive -Name P -PSProvider FileSystem -Root ‘\nfs-share\C9R’ -Credential $credential -Persist | Out-Null;

After this I’m able to type “cd \nfs-share\C9R” and have there RW access.