[英]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.我正在尝试使用 Pipeline 中的 PowerShell 任务在 DevOps 代理服务器中创建 RamDisk。 The script can create the Ramdisk rive but unable to format and mount it.
该脚本可以创建 Ramdisk 驱动器,但无法对其进行格式化和挂载。 Its giving error that it needs elevated prompt.
它给出的错误是它需要提升提示。 How I can run PowerShell task with admin privileges in Azure DevOps pipeline
如何在 Azure DevOps 管道中以管理员权限运行 PowerShell 任务
Since you add azure-devops-self-hosted-agent
tag, I assume you are using a self-hosted build agent for build.由于您添加了
azure-devops-self-hosted-agent
标记,因此我假设您使用的是自托管构建代理进行构建。 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.运行
services.msc
并查找代理。 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.
相反,尝试重新配置代理并使用管理员帐户运行它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.