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
2 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.mscand 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.
3 Comments
- I have created Service Account with full admin privileges on my self-hosted agent
- I have added the self-hosted agent to the Azure DevOps pool and configured it using this Service Account
- All my tasks are running with admin privileges
My suggestion would be to configure the self-hosted agent using your Administration Account