【发布时间】:2020-12-05 06:37:00
【问题描述】:
我试图通过 Azure devops Pipeline 在 PS Inline 脚本下运行。但是我在代理日志上遇到错误 管道代码:
trigger:
master
pool:
name: 'Dev1'
steps:
task: PowerShell@2
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
New-Item -Path "C:\Manoj" -Force
代理错误:
Starting: PowerShell
Task : PowerShell
Description : Run a PowerShell script on Linux, macOS, or Windows
Version : 2.165.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
Generating script.
========================== Starting Command Output ===========================
"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\tmp\vsts-agent-win-x64-2.165.2_work_temp\65dd1488-c132-4b9a-8403-0604d37f43a4.ps1'"
New-Item : Access to the path 'C:\Manoj' is denied.
At C:\tmp\vsts-agent-win-x64-2.165.2_work_temp\65dd1488-c132-4b9a-8403-0604d37f43a4.ps1:4 char:1
New-Item -Path "C:\Manoj" -Force
+ CategoryInfo : PermissionDenied: (C:\Manoj:String) [New-Item], UnauthorizedAccessException
+ FullyQualifiedErrorId : NewItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.NewItemCommand
##[error]PowerShell exited with code '1'.
Finishing: PowerShell
【问题讨论】:
-
该错误表明存在访问问题。您是否朝那个方向进行了调查?