Linux虚拟机中的Azure DevOps虚拟机规模集部署

Linux虚拟机中的Azure DevOps虚拟机规模集部署,azure,shell,deployment,devops,azure-vm-scale-set,Azure,Shell,Deployment,Devops,Azure Vm Scale Set,我试图在Azure DevOps发行版Pipleine中使用在Vm规模集上运行自定义脚本Vm扩展在Azure Vm规模集中部署。我有一个执行部署后任务的shell脚本 在发布管道中,我使用一个存储帐户来归档工件,并取消选中跳过归档自定义脚本。在VMS部署任务中,我遇到以下错误: 2020-03-06T22:59:44.7864691Z ##[error]Failed to install VM custom script extension on VMSS. Error: VM has rep

我试图在Azure DevOps发行版Pipleine中使用在Vm规模集上运行自定义脚本Vm扩展在Azure Vm规模集中部署。我有一个执行部署后任务的shell脚本

在发布管道中,我使用一个存储帐户来归档工件,并取消选中跳过归档自定义脚本。在VMS部署任务中,我遇到以下错误:

2020-03-06T22:59:44.7864691Z ##[error]Failed to install VM custom script extension on VMSS. 
Error: VM has reported a failure when processing extension 'AzureVmssDeploymentTask'. 
Error message: "Enable failed: failed to execute command: command terminated with exit status=126

[stdout]

extracting archive cs.tar.gz
Invoking command: ./"main.sh"

[stderr]

./customScriptInvoker.sh: line 12: ./main.sh: Permission denied
我在scale set vm的/var/lib/waagent/custom script/download/1目录下找到了customScriptInvoker.sh

#!/bin/bash
if [ -n "$1" ]; then
   mkdir a
   echo "extracting archive $1"
   tar -xzC ./a -f $1
   cd ./a
fi

command=$2" "$3
echo $command
echo "Invoking command: "$command

eval $command

这个问题应该怎么解决

似乎缺少shell执行权限

我假设您正在同一文件夹中运行bash脚本 我会试试看

chmod +rx main.sh
您可以验证权限

ls -l main.sh

您还可以使用发布
main.sh
customScriptInvoker.sh
的所有权吗

ls -la main.sh
ls -la customScriptInvoker.sh

检查它们是否属于可能不属于同一组的不同帐户。如果是这种情况,那么在尝试从其他脚本内部执行main.sh脚本时,也会出现“权限被拒绝”错误。如果是这种情况,可以使用
chgrp
命令将main.sh文件更改为与其他文件属于同一组。您还可以使用
chown
将main.sh文件的所有权更改为与其他文件具有相同的所有权。如果看不到文件的权限和所有权,很难判断。

您可以在shell脚本中尝试使用sudo权限运行该命令。@David_001您需要在某些消息中提出新问题。