【发布时间】:2026-02-08 09:15:02
【问题描述】:
我目前正在使用 ARM 模板部署 VM 规模集 (VMSS),该模板在 VMSS 中有一个资源,用于安装 Azure DevOps (ADO) 部署代理的 Azure 扩展。全部部署成功,节点在 ADO 中注册,所有详细信息与 ARM 模板中的一样。但是问题在于它仅在第一个节点上安装代理,并且(据我所知)忽略了其余节点。在创建规模集和自动缩放期间,我已经使用多个节点对此进行了测试。这两种情况都会导致只有第一个代理注册。 这是我正在使用的代码布局(我在这里删除了 VMSS 位以减少模板长度,当然里面有操作系统、存储和网络设置):
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[parameters('VMSSName')]",
"apiVersion": "2018-10-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "[parameters('VMSSSize')]",
"capacity": "[parameters('VMSSCount')]",
"tier": "Standard"
},
"dependsOn": [],
"properties": {
"overprovision": "[variables('overProvision')]",
"upgradePolicy": {
"mode": "Automatic"
},
"virtualMachineProfile": {},
"storageProfile": {},
"networkProfile": {},
"extensionProfile": {
"extensions": [
{
"type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
"name": "VMSS-NetworkWatcher",
"location": "[resourceGroup().location]",
"properties": {
"publisher": "Microsoft.Azure.NetworkWatcher",
"type": "[if(equals(parameters('Platform'), 'Windows'), 'NetworkWatcherAgentWindows', 'NetworkWatcherAgentLinux')]",
"typeHandlerVersion": "1.4",
"autoUpgradeMinorVersion": true
}
},
{
"type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
"name": "VMSS-TeamServicesAgent",
"location": "[resourceGroup().location]",
"properties": {
"publisher": "Microsoft.VisualStudio.Services",
"type": "[if(equals(parameters('Platform'), 'Windows'), 'TeamServicesAgent', 'TeamServicesAgentLinux')]",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": true,
"settings": {
"VSTSAccountName": "[parameters('VSTSAccountName')]",
"TeamProject": "[parameters('VSTSTeamProjectName')]",
"DeploymentGroup": "[parameters('VSTSDeploymentGroupName')]",
"AgentName": "[concat(parameters('VMSSName'),'-DG')]",
"Tags": "[parameters('VSTSDeploymentAgentTags')]"
},
"protectedSettings": {
"PATToken": "[parameters('VSTSPATToken')]"
}
}
}
]
}
}
}
}
当然,现在想要的状态是所有节点都安装了代理,这样我就可以在发布管道中使用部署组。
【问题讨论】:
标签: azure azure-devops azure-virtual-machine continuous-deployment azure-vm-scale-set