1

I'm creating a pipeline that downloads an artifact and installs it, and after installation some files are created in C:\ directory. But, it seems that the user running the installation does not have permission to create folders in C:. How do I give permission to create files in Azure using powershell or command line on my Azure pipeline? According to my research one of the commands would be the one below, but it does not work in my pipeline (it is stuck in this task for approximately 1 hour in the task bellow). Can anyone tell me what's wrong?

Here is my task on my pipeline:

- task: PowerShell@2
    inputs:
      targetType: 'inline'
      script: |
        $acl = Get-Acl C:
        $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("SYSTEM","CreateFiles","Allow")
        $acl.SetAccessRule($AccessRule)
        $acl | Set-Acl C:
        $acl = Get-Acl C:
        $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("VssAdministrator","CreateFiles","Allow")
        $acl.SetAccessRule($AccessRule)
        $acl | Set-Acl C:

What I tried: PowerShell To Set Folder Permissions How to set Write permission on a folder for Everyone Using Powershell How to change permissions for a folder and its subfolders/files in one step?

tester1908
  • 73
  • 1
  • 5

1 Answers1

1

just to get it right:

The user who runs the installation is VssAdministrator correct?

Have you tried it with "FullControl" ? Because I think "createfiles" will not be enough.

And if its an normal system c: partition, the thrustedinstaller is the owner. Maybe your settings are not applied? If you do an set-acl and than call an get-acl, does it show your setting?

Thats what I would try:

  • Try with fullcontrol (you always can limit it down afterwards) . check the get-acl after set command.
  • Hi, thanks for the response. I tried to set FullControl, but not working too.Yeah, my user is VssAdministrator.My settings are not applied with set-acl when I run the pipeline, the task is running for more than 1 hour – tester1908 Nov 27 '20 at 00:00
  • I suspect that the task gets stuck trying to execute something and I can't find the reason – tester1908 Nov 27 '20 at 00:05