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?