-1

We have set up the Azure DevOps Release Pipeline with a custom Agent that is running in Azure VM. Agent has to run also end-to-end tests from DevOps Release, hence it starts interactively via:

C:\windows\system32\cmd.exe /D /S /C start "Agent with AutoLogon" "C:\agent\run.cmd" --startuptype autostartup 

User that is automatically logged in (and runs the command above) VM is part of Administrator group. Everything runs fine until I try to run "PowerShell Script" which requires admin privileges. For example "Import-Certificate" command gives me "Access Denied" error. I know about workaround with

Start-Process powershell -ArgumentList 'command' -Verb RunAs

That is working fine, but with this, I am missing the output of the 'command'. I mean, whether the 'command' fails or succeeds it does not notify back to output.

Any ideas on how can I run elevated PS or what other permissions to configure?

3
  • Try running your agent as a service and run it on a service account which has admin privileges on the box. docs.microsoft.com/en-us/azure/devops/pipelines/agents/… – Vinay Jan 25 at 21:14
  • That is one of the solutions, but unfortunately not suitable for me. I need to run end-to-end tests from DevOps so the Agent needs to run in "Interactive" mode. I will add that info to the original question. – krs Jan 27 at 7:58
  • You may be able to add a step in your Azure pipeline to run e2e steps, you do not need to run the agent in interactive mode for that. Correct me if I am wrong, but you want to do run script + run e2e ? If you configure a pipeline to do that with that agent it should suffice. And custom agent = on-prem azdevops agent right ? – Vinay Jan 27 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.