Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run PowerShell task with admin privileges in Azure Devops pipeline

I am trying to create RamDisk in DevOps agent servers using PowerShell task from Pipeline. The script can create the Ramdisk rive but unable to format and mount it. Its giving error that it needs elevated prompt. How I can run PowerShell task with admin privileges in Azure DevOps pipeline

like image 283
devayanops Avatar asked Nov 07 '22 04:11

devayanops


1 Answers

Since you add azure-devops-self-hosted-agent tag, I assume you are using a self-hosted build agent for build. Then you can try to update the build agent to run with an administrator account.

If you configured the agent to run as a service, it starts automatically. You can view and control the agent running status from the services snap-in. Run services.msc and look for the agent. If you need to change the agent's logon account, don't do it from the Services snap-in. Instead, try to re-configure the agent and run it with an administrator account.

like image 176
Cece Dong - MSFT Avatar answered Nov 15 '22 07:11

Cece Dong - MSFT