You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过Azure流水线注册Linux虚拟机至环境时config.sh执行失败

Troubleshooting Failed config.sh Execution via Azure VM Custom Script Extension

Hey there, sorry to hear you're stuck getting your VM registered via the config.sh script through the Azure Custom Script Extension. Let's break down some common fixes and troubleshooting steps since the specific error details weren't included in your question:

1. First, grab the actual error details

The Custom Script Extension logs on Linux will tell you exactly what's going wrong. Check these log files on your VM:

  • /var/log/azure/custom-script/extension.log
  • /var/log/azure/Microsoft.CPlat.Core.CustomScriptExtension/*/extension.log

These logs will show if the script failed to download, had permission issues, or threw a specific error during execution.

2. Ensure the script has execution permissions

Sometimes when the config.sh script is deployed via the extension, it might not have executable permissions. Modify your extension command to add a permission check first:

chmod +x ./config.sh && ./config.sh --environment --environmentname "myEnvironment" --acceptteeeula --agent $HOSTNAME --url myUrl --work _work --projectname 'routing' --auth PAT --token myToken --unattended

3. Double-check your parameter values and spelling

A lot of script failures come from typos or invalid parameters:

  • --url myUrl: Make sure this is a valid Azure DevOps organization URL (e.g., https://dev.azure.com/your-organization-name). Don't leave it as the placeholder myUrl.
  • $HOSTNAME: Verify this variable resolves correctly in the extension's execution context. Try replacing it with a fixed agent name (like my-linux-agent) to rule out variable issues.
  • --acceptteeeula: Check if this is a typo—some versions of the Azure DevOps agent script use --acceptTeeEula (camel case) or --accept-eula instead of all lowercase with extra 'e's.
  • PAT Token: Confirm your Personal Access Token has the right permissions: it needs Agent Pool (Read & Manage) and Project (Contribute) permissions, and hasn't expired or been revoked.

4. Verify network connectivity from the VM

Your VM needs to reach Azure DevOps and any other required endpoints:

  • Test access to your Azure DevOps URL with curl -v https://your-devops-url from the VM's terminal.
  • Ensure your VM's NSG rules allow outbound traffic to HTTPS (port 443) for Azure DevOps domains.
  • If your script is hosted in Azure Blob Storage, confirm the VM can access that storage account (check firewall settings on the storage account if it's restricted).

5. Test the script manually first

SSH into your VM and run the config.sh command directly. This will let you see the exact error message in real-time, bypassing the Custom Script Extension layer. If it fails manually, you'll know the issue is with the script or parameters, not the extension itself.

6. Check the extension's deployment status

Use the Azure CLI to get detailed status on the extension deployment:

az vm extension show --resource-group <your-resource-group> --vm-name <your-vm-name> --name CustomScriptExtension

Look for the provisioningState and statusMessage fields—they often include helpful error context.


内容的提问来源于stack exchange,提问作者Marlena

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.01 00:02:52