【发布时间】:2021-07-14 23:46:13
【问题描述】:
Azure DevOps 正在覆盖所需 Web 文件的文件权限。因此,我决定在我的 YAML 管道中添加一个步骤,以确保始终正确设置文件权限。
我使用命令行工具 (CMD) 在服务器上对其进行了测试,效果很好。但是,我将 Step 添加到了 YAML 中,但出现以下异常。
“RX”一词未被识别为 cmdlet、函数的名称, 脚本
- 我的 YAML 命令行有问题吗?
使用命令行工具 (CMD):
这是我使用 CMD 测试的 RAW 命令行...它工作正常...(RX) parameter 是正确的。
icacls "D:\Applications\MyApplication\bin\Select.Html.dep" /grant:r "mydomain\my_ServiceAccountName_DEV":(RX)
YAML 管道:
命令行(本身)显然是在 PowerShell 中运行的。但我是 YAML 的新手……所以格式可能已经关闭(有点)。有人可以帮忙吗?
#-------------------------------------
#Update File-Permissions for ServiceAccount
- stage: Update_File_Permissions
jobs:
- deployment: Update_File_Permissions
displayName: Update File Permissions
environment:
name: 'Purposely Omitted'
resourceType: 'VirtualMachine'
tags: 'Purposely Omitted'
variables:
DevAppFolder: 'Purposely Omitted'
strategy:
runOnce:
deploy:
steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
d:
cmd /c icacls "D:\Applications\MyApplication\bin\Select.Html.dep" /grant:r "mydomain\my_ServiceAccountName_DEV":(RX)
【问题讨论】: