azure-dev: [Issue] azuretools.azd: ##[error]EPERM: operation not permitted, symlink '...\azd-install\azd-windows-amd64.exe' -> '...\azd-install\azd.exe'

- [ ] Make sure you’ve installed the latest version using instructions in the wiki <-- Does not apply

Output from azd version NA… trying to install it

Describe the bug

After installing the azuretools.azd extension, when running setup-azd@0 on Self-Hosted Agent, it results in an error:

##[error]EPERM: operation not permitted, symlink '...\azd-install\azd-windows-amd64.exe' -> '...\azd-install\azd.exe'

To Reproduce Run an Azure DevOps Pipeline with setup-azd@0 task

Expected behavior No error 😃

Environment Information on your environment: * Language name and version NA * IDE and version : [e.g. Visual Studio 16.3] NA

Additional context Thank you for all your efforts out there. They are appreciated. 🙏

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 20 (10 by maintainers)

Most upvoted comments

@v-xuto @hemarina can you triage this? cc @vhvb1989

OK one less mystery to worry about @hemarina 😅 Thank you for the clarification 🙏

@Mike-E-angelo I used Network Service for reproduction according to https://github.com/Azure/azure-dev/issues/4282#issuecomment-2328207422. It works with setup-azd@0 and resolves permission issue if you use System.

@Mike-E-angelo , according to this: https://stackoverflow.com/questions/66361808/what-permissions-are-needed-for-the-azure-devops-deployment-group-agent:

If you run it under other accounts/roles, it will fail with unexpected errors

You might want to look at this.

Thanks for your feedback @Mike-E-angelo

The Install azd extension finds a way to assign necessary permissions to the Log On identity to use the setup-azd@0 task

This is not possible by OS design. Applications can’t auto-elevate its access permissions and more important, they shouldn’t.

What you are facing is beyond Azure DevOps tasks. It is 100% related to how the self-host is configured to dispatch pipelines. Only the self-host owner should be able to set what OS user handles the pipelines and what permissions that user has.

A local system account is used to run your pipeline in the self-host machine. You need to know what that account limits are and set it up.
The account might not only fail for the install azd task, but for any application trying to write files in disk.

The install azd taks is getting an OS - access error when trying to write a file to this path: image

You can try to set up the account in the self-host to be able to write new files in that path by running a pipeline with a pwsh task to write and move files. I think that, since the path where the account is running was not created by that account (but with another account), there is no access allowed. Make the NT AUTHORITY\SYSTEM account an owner of the C:/agent path

@rajeshkamal5050, We can reproduce this issue when running an Azure DevOps Pipeline with setup-azd@0 task on Self-Hosted Agent. Besides, when running setup-azd@0 on the windows-latest vmImage in the Microsoft-Hosted Agent, this issue no longer reproduces. image

Hi @rajeshkamal5050 I did look into this and it’s running under NETWORK SERVICE. I tried giving this folder Full Control to this account specifically and propagating this down to all children but the problem still persists. I am open to any further suggestions on how to address this.